Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git: Why am I ahead of origin/master with X commits after I do 'git push'?

I am using a bare git repository on a server for backup, and push local changes there with 'git push' after doing 'git commit' locally.

'git status' tells me

# On branch master
# Your branch is ahead of 'origin/master' by X commits.

If I modify a file, and then do another commit followed by a push, git tells me that my branch is ahead by X+1 commits. 'git remote show origin' shows me that both fetch and pull URLs are the same as I supply as argument to push.

I have verified that my changes do indeed get pushed to the server repository (by pulling into a different location and checking the contents).

What am I doing wrong here?

PS: I am aware that there are several related questions here on SO, but I could not find the answer to my specific issue in any of those. Please point me in the right direction if I'm wrong in that regard.

like image 255
Eyvind Avatar asked Oct 11 '10 14:10

Eyvind


1 Answers

It sounds like you're pushing to the URL directly. Try git push origin, this will update the references for origin (in principle, you can have the same URLs twice with the same reference name: the message refers to the reference name).

like image 114
Bruno Avatar answered Sep 23 '22 00:09

Bruno