Skip to content

Commit 77d3325

Browse files
author
amzyang
committed
fix: fatal: cannot lock ref 'HEAD' issue #191
1 parent 5f210d4 commit 77d3325

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

cmd/commit.go

+7
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ var (
4141

4242
defaultTimeout = 30 * time.Second
4343
noConfirm = false
44+
noCommit = false
4445
)
4546

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

@@ -321,6 +324,10 @@ var commitCmd = &cobra.Command{
321324
}
322325
}
323326

327+
if noCommit {
328+
return nil
329+
}
330+
324331
// git commit automatically
325332
color.Cyan("Git record changes to the repository")
326333
output, err := g.Commit(commitMessage)

git/templates/prepare-commit-msg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
22

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

0 commit comments

Comments
 (0)