3

Why do I see a git merge prompt message keep popping up everytime after I do git pull ?

I am 100% sure that there is nothing is merging.

It so annoying, does anybody know how to stop it ?

enter image description here

code-8
  • 54,650
  • 106
  • 352
  • 604
  • possible duplicate of [Why is git prompting me for a post-pull merge commit message?](http://stackoverflow.com/questions/11744081/why-is-git-prompting-me-for-a-post-pull-merge-commit-message) – Hexaholic May 07 '15 at 14:22
  • ‘*I am 100% sure that there is nothing is merging.*’ How? Do you not have any un-pushed commits? – Biffen May 07 '15 at 14:23
  • @Hexaholic : I tried every answer there. Nothing seem to work. – code-8 May 07 '15 at 14:36
  • @rangerover.js Could you show us the output of `git status`? – Biffen May 07 '15 at 14:38
  • If I do `git status` now, I will get `On branch master Your branch is up-to-date with 'origin/master'. nothing to commit, working directory clean` – code-8 May 07 '15 at 14:40
  • This is on my production server running Linux. – code-8 May 07 '15 at 14:41
  • If I edit something on my local env, push it, and pull it from my production server again, I will get the git merge prompt again. :( – code-8 May 07 '15 at 14:41
  • hmm...maybe you have the config `pull.ff` set to false (check it with [git-config](http://git-scm.com/docs/git-config)) – Diego May 07 '15 at 14:52

2 Answers2

7

Why do I see a git merge prompt message keep popping up everytime after I do git pull ?

Because git pull is essentially a fetch followed by a merge, and the default behavior of merge is to automatically commit the result.

You can avoid the editor by supplying the --no-edit option, in which case you'll get an automatically generated message for your commit.

Caleb
  • 124,013
  • 19
  • 183
  • 272
1

If I'm not mistaken, this means a fast-forward merge was not possible. Usually this happens when there are commits in master that are not present in origin's master branch (or whatever branch you are pulling from/merging to)

In that case history, after the fetch done by git-pull, would look like the following:

                       origin/master
                       |
-- A -- B -- C -- D -- E
              \
               +-- D'
                   |
                   master

To bring changes D and E into the local master branch, git needs to introduce a merge commit, M (which records the parents and solves potential merge conflicts), and that's why it's asking you for a messsage.

History after the merge looks like in the following graph:

                       origin/master
                       |
-- A -- B -- C -- D -- E
              \         \
               +-- D' -- M 
                         |
                         master

This is the default behaviour as far as I can tell. However, git-pull documentation says:

The --no-edit option can be used to accept the auto-generated message (this is generally discouraged).

DISCLAIMER: I don't have git available right now to test it :(

Diego
  • 1,789
  • 10
  • 19