Skip to content
Home » How to make git use the editor of my choice for commits ?

How to make git use the editor of my choice for commits ?

To make git use the editor of my choice for commits use core.editor option in git config. You can use any editors like vim, emacs, notepad++ etc.,

If you want to set vim as your editor then, one of the easy way of doing this is :

git config --global core.editor "vim"

Another way :

To export the Git environmental variable to the editor. It can be done through:

export GIT_EDITOR=vim

You can also Set the standardised VISUAL and EDITOR environment variables* to set the editor for Git as well as other programmes:

export VISUAL=vim
export EDITOR="$VISUAL"

In Windows :

If you want to setup notepad ++ as a default editor, then use:

git config --global core.editor 'C:/Program Files/Notepad++/notepad++.exe'

Also Read:

How to modify a specific commit in Git ?