How can I force git merge
to use the default merge message instead of loading my editor with said message?
I have no editor listed in git config -l
, so I'm not sure why it opens an editor.
--no-edit
?
Found the answer after some digging
EDIT: As per Mark's suggestion, this is the best way to do so:
git config --global core.mergeoptions --no-edit
Use
export GIT_MERGE_AUTOEDIT=no
or
git merge --no-edit
git merge
git merge
. Perhaps git merge -m "message"
works but I haven't tried it yet.
export GIT_MERGE_AUTOEDIT=no
worked (for merges) when the accepted answer (git config --global core.mergeoptions --no-edit
) did not.
This is a new feature of Git, introduced in Git 1.7.10, to use the old one (don't provide a message on merge) put these two lines in your .bash_profile
or .bashrc
GIT_MERGE_AUTOEDIT=no
export GIT_MERGE_AUTOEDIT
try this
git merge --no-ff --no-edit -m "my custom merge message" somebranch
Success story sharing
~/.gitconfig
directly, it might be safer to suggest usinggit config
to do this, e.g.git config --global core.mergeoptions --no-edit
, so that there's no chance of creating a malformed~/.gitconfig
.git merge
's, but I'm still having an editor open up forgit pull
's. Is there any way to disable the commit message for this as well?core.mergeoptions
, though it certainly applies tobranch.*.mergeoptions
. Does anyone know the supported versions for this?core.mergeoptions
. There is, however, aGIT_MERGE_AUTOEDIT=no
that was added to git 1.7.10 whengit merge
itself was changed to bring up the editor. There are also options available asbranch.*.mergeoptions
, as @cmbuckley noted.