The git config
command is used to change different configurations about the git. The git editor is used to edit files or add some comments to the commits etc. If the git editor is not specified the default editor is used. Also, the git editor can be changed with the git config
command.
Change Git Editor
For the current repository, the git editor can be changed with the following command. In the following example, we set the git editor as nano
. The core.editor
is used to specify the editor.
$ git config core.editor "nano"
Alternatively, we can specify the editor’s complete path like below.
$ git config core.editor "/bin/nano"
Change Git Editor Globally
We can change the git editor globally for the current user. The specified editor will be set as default for all repositories for the current user. The --global
option is added to the git config core.editor
.
$ git config --global core.editor "nano"
Text Editor | Global Git Config Command |
---|---|
Atom | git config –global core.editor “atom –wait” |
emacs | git config –global core.editor “emacs” |
Textmate | git config –global core.editor “mate -w” |
vim | git config –global core.editor “vim” |
Nano | git config –global core.editor “nano” |