I understand that if I have commits on my local master
branch that are not in the remote master
branch, then I can get "Your branch is ahead of origin/master by X commits".
But, after I git pull origin master
, I see the message "Already up-to-date". So, I thought that means exactly that: none of my commits are ahead/behind master.
But when I do git status
still am receiving this message "Your branch is ahead of origin/master by X commits". Even when I do git pull -f origin master
I'm still getting this message!! How is that possible when I'm "Already up-to-date"?
I understand questions like this, but they still don't tell me why the "up-to-date" means "ahead"?
Let’s illustrate by below graphs:
Assume this is the remote master branch,
And this is your local master branch, you make X commits on local,
So when you want to pull remote master branch(commit A,B and C) to local which already exist in local commits, so git will show
already up-to-date message
for you. And this is consistent with git status’ messgeYour branch is ahead of origin/master by X commits
.