fix: install pre-checkout hook in gt git-init

The hook was only installed via 'gt install --git' but not when
running 'gt git-init' separately.
This commit is contained in:
Dustin Smith
2026-01-19 20:54:40 +07:00
parent 7421d1554d
commit 6f9bfec60f

View File

@@ -138,6 +138,11 @@ func runGitInit(cmd *cobra.Command, args []string) error {
fmt.Printf(" ✓ Git repository already exists\n")
}
// Install pre-checkout hook to prevent accidental branch switches
if err := InstallPreCheckoutHook(hqRoot); err != nil {
fmt.Printf(" %s Could not install pre-checkout hook: %v\n", style.Dim.Render("⚠"), err)
}
// Create GitHub repo if requested
if gitInitGitHub != "" {
if err := createGitHubRepo(hqRoot, gitInitGitHub, !gitInitPublic); err != nil {