tags:

views:

457

answers:

3

How does this actually come about?

I am working in one repo by myself at the moment, so this is my workflow:

1- change files
2- commit
4- repeat until satisfied
4- push to master

Then when I do a git status it tells me that my branch is ahead by X commits (presumably the same number of commits that I have made). Is it because when you push the code it doesn't actually update your locally cached files (in the .git folders)? git pull seems to 'fix' this strange message, but I am still curious why it happens, maybe I am using git wrong?


including what branch is printed in the message

My local branch is ahead of master

where do you push/pull the current branch

I am pushing to github and pulling to whichever computer I happen to be working on at that point in time, my local copy is always fully up to date as I am the only one working on it.

it doesn't actually check the remote repo

That is what I thought, I figured that I would make sure my understanding of it was correct.


are you passing some extra arguments to it?

Not ones that I can see, maybe there is some funny config going on on my end?

$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
nothing to commit (working directory clean)
+2  A: 

It just reminds you the differences between the current branch and the branch which does the current track. Plesa provide more info, including what branch is printed in the message and where do you push/pull the current branch.

wRAR
+3  A: 

I think you’re misreading the message — your branch isn’t ahead of master, it is master. It’s ahead of origin/master, which is a remote tracking branch that records the status of the remote repository from your last push, pull, or fetch. It’s telling you exactly what you did; you got ahead of the remote and it’s reminding you to push.

jleedev
This is actually after I pushed. I had to pull (or possibly fetch?) to get it to not have that message.
SeanJA
+1  A: 

If you get this message after doing a "git pull remote branch", try following it up with a "git fetch".

Fetch seems to update the local representation of the remote branch, which doesn't necessarily happen when you do a "git pull remote branch".

Rich