Why does git say I am 40 commits ahead when I seem up to date and a push-pull (no files) fixes it?

Viewed 2765

I switch to master and it says I am ahead by 40 commits:

$ git checkout master
Switched to branch 'master'
Your branch is ahead of 'origin/master' by 40 commits.

But when I then do a pull it says I am up-to-date:

$ git pull origin master
From https://github.com/dmcouncil/dmWorkflow
 * branch            master     -> FETCH_HEAD
Already up-to-date.

However I can resolve this (remove the 40 commits msg) with:

Michaels-MacBook-Pro-2:dmWorkflow durrantm$ git push origin master
Everything up-to-date

and now the '40 commits' message is gone:

$ git status
# On branch mdd_play_settings_and_topics_reports
nothing to commit (working directory clean)

Why do I have to do the extra push (of what seems like nothing) to get in sync?
Is there a better approach I can take to this?

2 Answers
Related