两者之间有什么区别?git pullgit fetch?


当前回答

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

git pull   …
DESCRIPTION

Runs git-fetch with the given parameters, and calls git-merge to merge the 
retrieved head(s) into the current branch. With --rebase, calls git-rebase 
instead of git-merge.

Note that you can use . (current directory) as the <repository> to pull 
from the local repository — this is useful when merging local branches 
into the current branch.

Also note that options meant for git-pull itself and underlying git-merge 
must be given before the options meant for git-fetch.

如果你想要合并历史,你会拉拉, 你会拉拉,你会拉拉拉,如果你只是"想要的cotz" ,因为有人一直在标记 一些文章在这里。

其他回答

git fetch将检索远程分支,以便您能够git diffgit merge它们与当前分支一起存在。git pull将运行当前分支所跟踪的远程条格获取,然后合并结果。您可以使用git fetch查看是否对远程分支有任何更新,而不必将其与您的本地分支合并。

git pull = git fetch + git merge 

人们必须牢记 git 的性质。 您有远程和本地分支( 不一定相同 ) 。 与其他源控制系统相比, 这可能会有点令人困惑 。

通常当您检出远程时,会创建本地副本,跟踪远程。

gitreach 将会与远程分支合作并更新您的信息 。

实际上,如果其他SWES同一个部门工作,就属于这种情况,而小型项目----一个部门----一个项目设想方案的情况很少。

您对本地分支的工作仍然完好无损 。 为了将更改带回您的本地分支, 您必须合并/ 重订远程分支的更改 。

git拉动正好就是这两个步骤(即 -- -- rebase to rebase rebase 而不是合并)

如果您的本地历史和远程历史有冲突, 您将被迫在一小块按键发布您的更改时进行合并 。

因此,这真正取决于你的工作环境的性质和使用经验。

Git 获取

您从源头通过获取下载到本地分支的更改 。 获取请求远程回购, 询问其他人所做的全部承诺, 但您没有在本地回购上。 获取这些承诺的下载, 并将其添加到本地仓库 。

基特合并

您可以通过合并命令获取下载的更改。 合并后将获取从获取中提取的承诺, 并尝试将其添加到您的本地分支。 合并后将保留您本地变化的承付历史, 这样当您以推力共享分支时, Git 将知道其他人如何将您的变化合并 。

吉特拉拉

抓取并合并一起运行的频率足够大, 足以创建一个将两者合并、 拉动、 合并的命令。 拉动时会抓取并合并, 以添加下载的字符串 。 @ info: whatsthis

这张图能帮上忙git pull基本上等于git fetch时当时git merge

This graphic could be of help. git pull is essentially equivalent to git fetch then git merge