stop git merge from opening text editor

Add the following line into your .bash_profile, .bashrc or .zshrc file:

export GIT_MERGE_AUTOEDIT=no

Use the --no-edit option, you can read about it in the documentation.

Note that using the default message is discuraged, since it provides no meaningful information about the changes introduced with this merge.


On a sidenote: To continue merging you probably have to close the editor.


If you have a git version prior to 1.7.8 there is still a way to achieve what you want by using the env command.

env GIT_EDITOR=: git merge <ref-you-want-to-merge>

For easier usage you could create an alias.

git config --global alias.merge-no-edit '!env GIT_EDITOR=: git merge'

Which then can be used using git merge-no-edit <ref-you-want-to-merge>.


You can use

git merge --no-edit

This is the man page :

--edit, -e, --no-edit Invoke an editor before committing successful mechanical merge to further edit the auto-generated merge message, so that the user can explain and justify the merge. The --no-edit option can be used to accept the auto-generated message (this is generally discouraged). The --edit (or -e) option is still useful if you are giving a draft message with the -m option from the command line and want to edit it in the editor.

Older scripts may depend on the historical behaviour of not allowing the user to edit the merge log message. They will see an editor opened when they run git merge. To make it easier to adjust such scripts to the updated behaviour, the environment variable GIT_MERGE_AUTOEDIT can be set to no at the beginning of them.

Tags:

Git

Merge