Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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.

share|improve this question
    
Not sure, but doesn't merge - as commit - have the option --no-edit? –  Joachim Isaksson Oct 5 '12 at 18:52

3 Answers 3

up vote 27 down vote accepted

Found the answer after some digging

edit your ~/.gitconfig with the following

[core]
    mergeoptions = --no-edit

EDIT: As per Mark's suggestion, this way, git config --global core.mergeoptions --no-edit, accomplishes the same goal but does so more safely.

share|improve this answer
9  
Rather than edit ~/.gitconfig directly, it might be safer to suggest using git config to do this, e.g. git config --global core.mergeoptions --no-edit, so that there's no chance of creating a malformed ~/.gitconfig. –  Mark Longair Oct 5 '12 at 22:04
    
This seems to work for git merge's, but I'm still having an editor open up for git pull's. Is there any way to disable the commit message for this as well? –  LandonSchropp Nov 21 '13 at 7:29
    
I can't find any mention of core.mergeoptions, though it certainly applies to branch.*.mergeoptions. Does anyone know the supported versions for this? –  cbuckley Nov 27 '13 at 16:49
    
This doesn't work for me. Both merge and pull still bring up an editor on non-ff merges. Using git 1.7.10.4 –  user2471887 Apr 30 at 16:38
    
Still working for me, git version 1.7.12.4 (Apple Git-37) –  kjb May 1 at 17:17

This is a new feature of Git, to use the old one (don't provide a message on merge) but those two lines in your .bash_profile or .bashrc

GIT_MERGE_AUTOEDIT=no
export GIT_MERGE_AUTOEDIT
share|improve this answer

Use

export GIT_MERGE_AUTOEDIT=no

or

git merge --no-edit
share|improve this answer
    
This is almost what I wanted, but it forces you to type --no-edit every time. The solution I found changes the default behavior of git merge –  kjb May 13 '13 at 1:46
1  
doesn't work when I git pull. –  Pineapple Under the Sea Jul 31 '13 at 10:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.