Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git says local branch is ahead of remote after having pulled from remote

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.

like image 553
Alfonso Avatar asked Oct 29 '10 14:10

Alfonso


1 Answers

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 : 'git pull origin mybranch' leaves local mybranch N commits ahead of origin. Why?

like image 138
J-16 SDiZ Avatar answered Nov 07 '22 12:11

J-16 SDiZ