Whenever I set up a new computer for development, one of the first things I do is tell terminal not to use Vim when asking me for commit messages.
I find Vim painful and one of the worst things about it is that even the command to close it is unintuitive. So I never want to find myself stuck in it and having to Google it yet again.
Below are the code snippets to past into your terminal. Note that, on Windows at least, you’ll need to make sure that path to the Sublime Text executable is correct. Just open a My Computer window and browse to that location to check or copy it.
If you want to use another text editor, you can do so also, you’ll just need to change everything within the single quotation marks. The other elements within the double quotation marks are still required and are explained below.
On Mac
git config --global core.editor "'/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl' -w --launch-or-new-window"
On Windows
git config --global core.editor "'c:/program files/sublime text 3/sublime_text.exe' -w --launch-or-new-window"
Now, when you type git commit Sublime text will open with a commit file ready for you. Simple type your message and save it, and then when you close the file or sublime text, terminal will continue.
You can also close without saving and the terminal will recognise that as you choosing to abort the commit.