git
automatically spawns your preferred $EDITOR
to prompt for a commit message when you run git commit
. So it may be as simple as leaving -m
off of your git commit
command
If git launches the wrong editor, or fails to launch an editor, try setting the EDITOR
environment variable to your preferred editor:
export EDITOR=/usr/bin/vim
Or, to only change the editor used by git, you can set core.editor
git config --global core.editor /usr/bin/vim
Using an editor to compose a commit message this way has a couple of further advantages. Git populates the file you are editing with a summary of the files that were changed in the commit, which should help you write a better commit message. Also, vim (and other editors) support basic syntax highlighting for this kind of file, making it even easier.