tl;dr Set the editor to something nicer, like Sublime or Atom
Here nice is used in the meaning of an editor you like or find more user friendly.
The underlying problem is that Git by default uses an editor that is too unintuitive to use for most people: Vim. Now, don't get me wrong, I love Vim, and while you could set some time aside (like a month) to learn Vim and try to understand why some people think Vim is the greatest editor in existence, there is a quicker way of fixing this problem :-)
The fix is not to memorize cryptic commands, like in the accepted answer, but configuring Git to use an editor that you like and understand! It's really as simple as configuring either of these options
- the git config setting
core.editor
(per project, or globally)
- the
VISUAL
or EDITOR
environment variable (this works for other programs as well)
I'll cover the first option for a couple of popular editors, but GitHub has an excellent guide on this for many editors as well.
To use Atom
Straight from its docs, enter this in a terminal:
git config --global core.editor "atom --wait"
Git normally wait for the editor command to finish, but since Atom forks to a background process immediately, this won't work, unless you give it the --wait
option.
To use Sublime Text
For the same reasons as in the Atom case, you need a special flag to signal to the process that it shouldn't fork to the background:
git config --global core.editor "subl -n -w"