problem
Amend it!
$ git commit --amend
I want to quit after all!
Fix you brain # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # ...
Get out without saving!
:q!
(The vim command)
Wow ah, it has been committed ah!
Date: Fri Dec 18 13:38:52 2015 +0900 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 you-need-amend.rb create mode 100644 but-i-walk-my-way.sh
Solution 1
commit --amend
1. Delete all commit messages.
Make no commit message. (Comments may be included)
# Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # Date: Fri Dec 18 13:38:52 2015 +0900
However. Because it will be committed if there is only one blank line / comment line. It would be safer to delete all the file contents. (If you keep pressing the d
key as well)
2. End saving
:x
(the vim command)
3. Results
Not committed (Return to the original)
Aborting commit due to empty commit message.
Solution 2
How is it usually?
In a normal commit that is not amend. It just seems OK if you exit without saving. ( :q!
)
environment
- git version 2.3.8 (Apple Git-58)
- vim 7.3
Aside
I noticed later that it was clearly explained in the commit editing message.
an empty message aborts the commit.
Original by
Git | commit --amend を途中で取り消しする方法 (コミットメッセージ入力中のキャンセル)