I started out thinking it would be smart to use a GUI editor for Git commits, but after admiring Andreas Kling’s workflow (YouTube) I realized that it would be much more efficient to embrace lighter “terminal” editors, such as nano or vi.
On Linux Mint, the default Git editor appears to be nano.
On Windows, using Git Bash, the default Git editor appears to be vi., and seems to understand Git comment syntax highlighting “out of the box”.
I did experiment with using nano, and adding git comment syntax highlighting using the recommendation here. But eventually I decided that learning the few key commands of vi was the best way to go.
So on Linux, I switched:
$ git config --global core.editor "vi" $ git commit
The terminal window now shows the VI editor.
Important Key Commands
$ git commit
The editor opens. Hit A (to “Append”) or I (to “Insert”) before you start typing your commit message.
When you’re done, hit [ESCAPE] : W Q to “Write” and “Quit” and return to the command line. Don’t forget the colon!
Alternatively, you get configure Git so that vi goes into Insert mode automatically:
$ git config --global core.editor "vi -c 'startinsert'"
(Thanks to perreal@stackoverflow)
Recent Comments