4

I'm wondering why git keeps throwing me a Merge warning message.

enter image description here

  • I have nothing to merge.
  • I already cleared all my stashes with git stash clear
  • On top of that, before I do git pull, I run git status :

enter image description here

Can someone tell me how to resolve this please ?

Jason D
  • 8,023
  • 10
  • 33
  • 39
iori
  • 3,236
  • 12
  • 43
  • 78
  • 1
    Saw this same thing yesterday with a colleague. I thought maybe he had fumble-fingered something, but now I think it's something to do with BitBucket. – isherwood Mar 05 '15 at 15:06
  • I'm glad to know that I am not the only one. – iori Mar 05 '15 at 15:07
  • Are you talking about the first screenshot? Are you sure you have fast-forward merge? – Max Komarychev Mar 05 '15 at 15:07
  • 3
    Try `git merge --abort`, maybe you have unfinished merges. – sashoalm Mar 05 '15 at 15:14
  • Yes, I am talking about the first screenshot. I been doing `git pull` for about 1 year now, and nothing like that ever happened, I never get this message, unless, I update something on my prodcution server which I am 100% sure that I didn't do that. – iori Mar 05 '15 at 15:14
  • @sashoalm : I got `fatal: There is no merge to abort (MERGE_HEAD missing).` – iori Mar 05 '15 at 15:16
  • 1
    Why is your branch ahead by 12 commits? – Vishwanath Mar 05 '15 at 15:30
  • See http://stackoverflow.com/questions/180272/how-to-preview-git-pull-without-doing-fetch , which might help you show what's in the incoming pull – nos Mar 05 '15 at 15:37
  • Was your branch behind the remote branch? That would justify the merge commit that you're getting here. – Makoto Mar 05 '15 at 15:43
  • @Makoto I think u mean ahead of remote branch... – Vishwanath Mar 05 '15 at 15:45

2 Answers2

2

I assume you are doing this on production server, and your deployment workflow consist of pull and deploy.

I guess that some time in the past you or someone else might have had made some changes on your production server to some file, and you have committed them as well. Now each time when you do pull on the production server this local commit is merged with commits on the remote.

One way to solve this is reset hard to remote branch.

git reset --hard origin/master

If you want to know what happened, you need to have a look at the branch tree or git logs to check if there have been a commit on your local branch in production server.


On a side note, you will want to do your pull with --ff-only option like following to prevent this from happening in future.

git pull --ff-only
Vishwanath
  • 6,284
  • 4
  • 38
  • 57
0

As a git pull is basically a git fetch + git merge, it tries to merge the things you have pulled so you get a merge commit.

If you like you, could do something about how to avoid merge commits here although it's just a way to bypass your issue.

d6bels
  • 1,432
  • 2
  • 18
  • 30
  • But I been doing git pull for about 1 year now, and nothing happened, I never get this message, unless, I update something on my prodcution server which I didn't. – iori Mar 05 '15 at 15:09
  • That's weird, nothing changed in your configuration? An update or something? – d6bels Mar 05 '15 at 15:20