Friday, July 20, 2012

git branch is ahead of master

I ran into this problem today.  Not really a problem, but a bit of a head scratcher.  I wrote some code pushed it to github and then went over to a production server and pulled the code from github.  Then I did a git status and it said that I was 23 commits AHEAD of master.

So the obvious answer is that I must have committed code 23 times in this directory and not yet pushed it up to github, but this directory is only used for pulling.  I wouldn't write code in the production folder.  A quick git diff origin/master seemed to show that almost all of the code in my folder was going to be pushed to github if I did a push.

I needed to run git fetch.  I did some searching on the Internet and found where someone said that my refs could be out of date.  I don't know what a ref is, but I ran git fetch anyway.  That caught my refs up because git status then said I was up to date.

No comments: