开发者

Git - phantom local commits

开发者 https://www.devze.com 2023-01-30 19:30 出处:网络
We\'re using Github. Once in a while, after a git pull, I run git status and am told that I\'m ahead of origin/master, whic开发者_开发知识库h is odd, because I think I\'ve committed everything. So I d

We're using Github. Once in a while, after a git pull, I run git status and am told that I'm ahead of origin/master, whic开发者_开发知识库h is odd, because I think I've committed everything. So I do a git push.

Sure enough, there's nothing to push. So I run git status again, and this time the "phantom local commits" are gone; I'm not ahead of origin/master after all.

My team mates have experienced this, too. We've only noticed it since we started using Github.

Any idea what's going on here?

Below is an example from my terminal, just after I did a git pull.

~/projects/formula[master]% git status
# On branch master
# Your branch is ahead of 'origin/master' by 2 commits.
#
nothing to commit (working directory clean)
~/projects/formula[master]% git push origin master
Everything up-to-date
~/projects/formula[master]% git status
# On branch master
nothing to commit (working directory clean)
~/projects/formula[master]%


Did you try the following?

git remote update orgin

It will update the status of your remote origin. You can also omit origin and update all your remotes at once.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号