views:

27

answers:

1

I’m sorry if the title isn’t clear, but this is a weird problem.

I git checkout to my "stage" branch and git pull to get my partner’s latest changes (which he pushed last night to the "stage" branch on the remote repository), and sure enough, they merge to my local "stage" branch. git log <branch> shows five commits he performed last night.

I then switch over to the master branch to pull that from the repo because he told me he merged those changes to the master branch after testing them. But when I git checkout stage to get back to my "stage" branch it says I’m ahead of the remote branch by 5 commits. I git log origin/stage and it shows none of the five commits I just pulled from that repository (the only remote repository on this project). git log stage shows the five commits on my local "stage" branch, so I’m at a loss at how the remote branch could have gone back in time immediately after serving me my partner’s latest commits.

I’m pretty new at this, so I’ll appreciate your patience with me, as I’m still trying to grasp DCVSs and there’s a good chance I’m simply misunderstanding something really basic.

A: 

Try this command:

git log origin/stage..stage

This show you what you are ahead of the remote. Do a git rebase origin/stage / git push as appropriate.

If it doesn't help, see this question : http://stackoverflow.com/questions/1741143/git-git-pull-origin-mybranch-leaves-local-mybranch-n-commits-ahead-of-origin

J-16 SDiZ
OK. So that showed me the five commit difference between my local stage branch and the remote stage branch. But I’m confused as to how those commits (which were performed by someone else on a separate location) managed to merge onto my local stage branch and then disappear from the remote stage branch.
Alfonso
see the linked question. You should do a `git pull` (no parameter) or `git pull origin`, *BUT NOT* `git pull <some url>:<remote ref>` if you have setup correctly.
J-16 SDiZ
Oh, sorry. For some reason all I saw in your answer was Try this command, the command and nothing else.
Alfonso
`git pull origin` reported “Already up-to-date.” yet did fix the “You’re ahead…” message, so thanks a lot! On the other hand, why does `git pull origin <branch>` make the above problem happen?
Alfonso