Skip to content

Commit 5076b92

Browse files
author
amzyang
committed
fix: fatal: cannot lock ref 'HEAD' issue #191
1 parent 1e19172 commit 5076b92

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

cmd/commit.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ var (
4040

4141
defaultTimeout = 30 * time.Second
4242
noConfirm = false
43+
noCommit = false
4344
)
4445

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

@@ -306,6 +309,10 @@ var commitCmd = &cobra.Command{
306309
}
307310
}
308311

312+
if noCommit {
313+
return nil
314+
}
315+
309316
// git commit automatically
310317
color.Cyan("Git record changes to the repository")
311318
output, err := g.Commit(commitMessage)

git/templates/prepare-commit-msg

Lines changed: 1 addition & 1 deletion
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)