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

Google Currency Converter

c# regex decimal converter currency

I had used this code in the last years however google seemed to have changed some of their links. For some reason I am getting this error message: "Input string was not in a correct format." in thi...

Django: Delete model object using template

python django django-models django-forms django-templates

I am currently using models to have users enter data, using templates (not admin) that is then stored, at which point the users can then see all the data they entered. I would like to also give use...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.