2

The following commands seem like a bug to me, but I'm not a git genius so...

$ git status
# On branch master
nothing to commit, working directory clean

$ git pull origin master

 app/controllers/cool_controller.rb                   | 22 ++++++++++++++++++++--
 app/controllers/application_controller.rb            | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------
 test/fixtures/interesting_model.yml                  |  2 +-
 test/fixtures/other_interesting_model.yml            | 10 +++++++++-

$ git status

# On branch master
# Your branch is ahead of 'origin/master' by 7 commits.
#   (use "git push" to publish your local commits)
#
nothing to commit, working directory clean

I disagree with git here, if I just pulled from master and I had no previous changes, how am I ahead of master?

And here is the other thing, if I do

git reset origin/master --hard

I lose the changes from the pull! So it seems like git is not updating the local origin/master when I pull. How can I fix this?

Thanks!

OneChillDude
  • 7,856
  • 10
  • 40
  • 79
  • Try a `git fetch`. See http://stackoverflow.com/questions/2432579/git-your-branch-is-ahead-by-x-commits?rq=1 – Tim Mar 28 '14 at 14:30

1 Answers1

1

Try this:

git fetch

See git: Your branch is Ahead by X commits for more information about why this should work.

Community
  • 1
  • 1
Tim
  • 41,901
  • 18
  • 127
  • 145