git: Your branch is Ahead by X commits
Git branch is ahead of origin/master
I have read both questions above and it still does not answer my questions. Basically what I did was
- Create a new repository in GitHub.
- Clone and get the data in my local linux box
- Make changes do “git add” then do a “git commit -m “message”
- Finally do a “git push https://github.com/username/sandbox.git“. This works fine and I use the https protocol that is advised instead of the SSH protocol (Please note if I do just “git push” it uses the SSH protocol which I have not configured yet and it fails)
- Perform “git pull https://github.com/username/sandbox.git” and also “git fetch https://github.com/username/sandbox.git” all of which performed successfully saying “Already up-to date”.
- Visit the github website and I can see the changes.
-
Now run “git status” and I now see the following
On branch master
Your branch is ahead of ‘origin/master’ by 9 commits.
This was not what I expected. Can someone tell me why git thinks I am ahead of the origin/master by 9 commits. I have pushed and pulled the data so I would expect my local repo to be in perfect sync with the remote master/origin repo.
The command “git branch -av” shows the following
* master a99daf0 [ahead 9] submit
remotes/origin/HEAD -> origin/master
remotes/origin/master 81c7ec1 remove out files
As a newbie what I actually needed was the answer described by “Mims H Wright” at How can I find the location of origin/master in git, and how do I change it? which eventually points to the link http://fvue.nl/wiki/Git%3a_Your_branch_is_ahead_of_the_tracked_remote_branch.
Basically I had to do