How do I stop a Git commit when VI is on the screen waiting for a commit message?

I have asked Git to perform a commit from within git bash, It has brought up VI as it always does.

I now wish to cancel the commit, how do I prevent proceeding with the commit from this point?

Answers


You have two options:

  • Provide an empty commit message. If it's a new commit and you haven't yet saved the message, you can simply use :q! (quit without saving). If you’ve already saved (or you're amending a previous commit), just delete the entire log message and save again. This can be done with ggdG + :wq in Vim.

  • Have the editor exit with a non-zero exit code. In Vim, you can use :cq (quit with an error code).

It's worth noting that you can always reset your working copy to the state it was in before the commit with git reset HEAD^.


Need Your Help

iOS: Grouped UITableView issue

iphone uitableview xcode4 grouped-table

When I try to change the table view style from Plain to Grouped in the attribute inspector and then build, it gives me the following error message: Uncategorized could not read archive. So what's the

How to know that object has been rotated only in 15 degree chunks in 3D?

c++ math object 3d rotation

I have an 3D object in 3D space oriented in some orientation. How can I know it has been rotated from its initial rotation q (in euler angles: 0, 0, 0) only in arbitrary number of 15 degree rotatio...