Skip to content

Commit

Permalink
fix: fatal: cannot lock ref 'HEAD' issue #191
Browse files Browse the repository at this point in the history
  • Loading branch information
amzyang committed Feb 2, 2025
1 parent dffec98 commit c6b9c40
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions cmd/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ var (

defaultTimeout = 30 * time.Second
noConfirm = false
noCommit = false
)

func init() {
Expand All @@ -65,6 +66,8 @@ func init() {
"show prompt only, don't send request to openai")
commitCmd.PersistentFlags().BoolVar(&noConfirm, "no_confirm", false,
"skip confirmation prompt")
commitCmd.PersistentFlags().BoolVar(&noCommit, "no_commit", false,
"skip commit")
_ = viper.BindPFlag("output.file", commitCmd.PersistentFlags().Lookup("file"))
}

Expand Down Expand Up @@ -321,6 +324,10 @@ var commitCmd = &cobra.Command{
}
}

if noCommit {
return nil
}

// git commit automatically
color.Cyan("Git record changes to the repository")
output, err := g.Commit(commitMessage)
Expand Down
2 changes: 1 addition & 1 deletion git/templates/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash

if [[ "$2" != "message" && "$2" != "commit" ]]; then
codegpt commit --file $1 --preview --no_confirm
codegpt commit --file $1 --preview --no_confirm --no_commit
fi

0 comments on commit c6b9c40

Please sign in to comment.