Why is git prompting me for a post-pull merge commit message?

GitGit Pull

Git Problem Overview


Recently, following any git pull, git has started spawning my text editor, and asking for a merge commit message. A commit message is already pre-filled, and I just have to save and close the window to complete the pull.

In the past, it would do the merge silently, with a standard commit message (along the lines of Merge branch 'dev' of remote.com:/repo into dev).

I recently updated git to version 1.7.11.3 (via homebrew), but can't think of anything else I might have done to change this behavior. Is this a setting, or is there otherwise some way of getting back to the way it was?

Git Solutions


Solution 1 - Git

In git 1.7.10, the git developers decided merge commits could be made too easily. As explained in this blog post, forcing the interactive commit message behavior should make those commit messages more detailed and could reduce the overall frequency of unnecessary merges.

You can use the --no-edit flag to avoid this behavior, but, well, don't. Merge commits, like any commits to history, should be well constructed. Your history should be nothing but useful.

Solution 2 - Git

To create a shortcut for future use, either:-

Edit your ~/.gitconfig with the following:

[core]
    mergeoptions = --no-edit

Or execute the following in Terminal

git config --global core.mergeoptions --no-edit

Solution 3 - Git

First, take heed of the warnings in Christopher's answer above.

Then, if you still want to disable automatic merge commit message editing, set this environment variable:

    GIT_MERGE_AUTOEDIT=no

This environment variable and its "no" setting are documented on the git merge doc page. It is recommended to use it only in scripts that need to merge non-interactively, but of course it can be set as part of your shell environment to make its effects more permanent.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionshanebonhamView Question on Stackoverflow
Solution 1 - GitChristopherView Answer on Stackoverflow
Solution 2 - GitDallas ClarkView Answer on Stackoverflow
Solution 3 - GitemackeyView Answer on Stackoverflow