Setting which editor to use

suggest change

There are several ways to set which editor to use for committing, rebasing, etc.

git config --global core.editor nano

For one command:

GIT_EDITOR=nano git commit

Or for all commands run in a terminal. Note: This only applies until you close the terminal.

export GIT_EDITOR=nano
export EDITOR=nano

Note: As above, this only applies to the current terminal; your shell will usually have a configuration file to allow you to set it permanently. (On bash, for example, add the above line to your ~/.bashrc or ~/.bash_profile.)

Some text editors (mostly GUI ones) will only run one instance at a time, and generally quit if you already have an instance of them open. If this is the case for your text editor, Git will print the message Aborting commit due to empty commit message. without allowing you to edit the commit message first. If this happens to you, consult your text editor’s documentation to see if it has a --wait flag (or similar) that will make it pause until the document is closed.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents