Why doesn't git fetch update local branch?

This question already has an answer here:

  • What is the difference between 'git pull' and 'git fetch'? 40 answers

  • To view the differences between your local branch and the remote branch before merging them, you can use git diff , as outlined in this question, after executing git fetch .

    If you want to execute the merge of your remote branch with your local branch without committing it immediately to allow you to review the result, you can use git pull --no-commit (as described on git-scm.com). The --no-commit option prevents Git from automatically committing a merge that may be part of the pull, which would allow you to review the merge result before committing it.


    git fetch downloads commits from the remote branch, but doesn't update your workspace. You won't see the commits until they are merged into your local branch.

    git pull is a combination of git fetch and git merge - this is why git pull appears to "fix" this behaviour.

    链接地址: http://www.djcxy.com/p/1198.html

    上一篇: 解决Git合并冲突有利于他们在拉动过程中的变化

    下一篇: 为什么不git获取更新本地分支?