pull-only repo's 'git status' saying the branch is ahead of origin/master. Why?

后端 未结 5 1673
别跟我提以往
别跟我提以往 2020-12-10 12:01

So here\'s the situation:

$ git status
# On branch master
# Your branch is ahead of \'origin/master\' by [x] commits.
#

5条回答
  •  旧时难觅i
    2020-12-10 12:33

    See this question: What is the difference between 'git pull' and 'git fetch'?

    AFAIK a git pull will look at the branch on origin and pull down the changes. But the local index of the branch is not up-to-date. git fetch will update the index of the branch so it understands what should be there. (basically what was referenced in the answer you linked to)

    I always do a git fetch before a git pull. Really I do a git fetch anytime I am going to be doing anything with remote branches.

    Also linked on the above question is this very good description of git fetch, pull and merge. http://longair.net/blog/2009/04/16/git-fetch-and-merge/

提交回复
热议问题