How can I prevent the dialog on doing git commit --amend

后端 未结 3 1820
臣服心动
臣服心动 2021-01-20 20:47

There is a dialog that pops up on running:

git commit --amend

That wants me to review the messages. Is there a way to omit this dialog and

相关标签:
3条回答
  • 2021-01-20 21:22

    --no-edit is what you are looking for

    git commit --amend --no-edit
    

    From this article:

    The editor will be populated with the message from the previous commit and including the --no-edit flag will allow you to make the ammendment to your commit without changing its commit message.

    0 讨论(0)
  • 2021-01-20 21:25

    Would git commit --amend -C HEAD work?

    I don't have a git repository convenient to test on, but in the help for commit:

    -C , --reuse-message=<commit>

    Take an existing commit object, and reuse the log message and the authorship information (including the timestamp) when creating the commit.

    0 讨论(0)
  • 2021-01-20 21:25

    Just hit enter and then Ctrl+X to keep the same message

    0 讨论(0)
提交回复
热议问题