git fetch & pull

来源:互联网 发布:迷彩加厚羽绒服淘宝 编辑:程序博客网 时间:2024/06/05 20:25

git fetch

git-fetch - Download objects and refs from another repository
从远程下载仓库,并建立一个origin/master的分支,此分支不可修改。fetch之后,本地修改,而远程仓库未修改则可以直接push,这个是所说的fast-forward。如果fetch之后,本地修改,而远程仓库也修改了,则需要再次fetch,然后merge,才能push。

git fetch [<options>] [<repository> [<refspec>…​]]git fetch [<options>] <group>git fetch --multiple [<options>] [(<repository> | <group>)…​]git fetch --all [<options>]

git fetch <远程主机名>
git fetch <远程主机名> <分支名>

git pull

git-pull - Fetch from and integrate with another repository or a local branch

git pull [options] [<repository> [<refspec>…​]]

git pull = git fetch + git merge
参考文献:
https://git-scm.com/docs/git-fetch
https://git-scm.com/docs/git-pull