如何使用`git merge`来达到与`git pull`相同的结果?
'git pull'和'git fetch'有什么区别?
上面的问题最重要的答案说
“用最简单的话来说,git pull执行git fetch,然后是git merge或git rebase。”
  我明白, git fetch && git rebase实际上就是git pull 。 
  但如何使用git fetch和git merge来实现相同的结果? 
这是我的实验:
git fetch && git rebase # correctly replays remote commits in working copy
git fetch && git merge upstream/master # error
merge: upstream/master - not something we can merge
  我希望git merge能够正确地重播当前工作副本中的远程提交 - 这是git pull作用。 
  你应该使用git fetch + git merge像git fetch; git merge origin/master  git fetch; git merge origin/master以达到与git pull默认行为相同的行为。  但是可以改变默认行为来使用rebase。 
更多关于merge和rebase之间的区别在这里:git pull VS git fetch git rebase
git fetch
该命令将下载远程存储库及其分支的状态,但不会对本地副本执行任何操作
git merge branch_to_merge
  这个命令会将branch_to_merge合并到你当前的分支中。  你不能只输入没有参数的git合并,因为git会回复: fatal: No commit specified and merge.defaultToUpstream not set 
git rebase
这个命令可以让你重写你的分支的历史并将其放在指定的提交上
链接地址: http://www.djcxy.com/p/45123.html上一篇: How to use `git merge` to achieve same result as `git pull`?
