Let’s go over how to configure the Git text editor used for commit messages.
Local
To check what editor you’re using:
git config core.editor # /usr/bin/vim
To set the editor to nano
:
git config core.editor nano
To set the editor to a custom binary of vim
:
git config core.editor /usr/local/bin/vim
Global
To reference global options, pass --global
after git config
.
Examples
To see the global config:
git config --global --list
To set the global core.editor
to emacs
:
git config --global core.editor emacs
This means when you create or clone a Git repository, the text editor used to edit commit messages—given no local overrides—is
emacs
.