Git pull 和 Git fick 之间有什么区别?


当前回答

git pull = git fetch + git merge 

其他回答

用最简单的术语来说, git pull 是一个 Git 抓取, 然后是 git 合并 。


git 在 refs/ remotes/ <remote> / 下获取远程跟踪分支的更新。 此操作随时可以安全运行, 因为它不会在 refs/ head 下更改您的本地分支 。

git 拉动使当地的一个分支能够更新其远程版本,同时更新其他远程跟踪分支。

Git Pull 的 Git 文档 :

git pull 运行 git 获取带有给定参数的 Git 抓取, 然后根据配置选项或命令行旗帜, 将调用 git 重新基准或 Git 合并以调和不同的分支 。

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 保有一份您自己的代码副本和远程仓库 。

命令 git 抓取时通过从远程仓库获取数据更新本地副本。 我们需要这个数据的原因是, 其他人可能对代码做了一些修改, 您想要不断更新自己 。

命令 Git 拖动将远程仓库的更改带到您保存您自己的代码的位置。 通常, git 拖动这样做的方式是先做一个“ git 抓取” , 将远程仓库的本地副本更新为最新版本, 然后将修改合并到您自己的代码仓库, 并有可能将您的工作副本合并到您自己的代码仓库中 。

有时视觉表现会有所帮助。

git 抓取时会检索远程分支, 这样您就可以将 diff 和当前分支合并。 git 抓取时会在当前分支跟踪的远程条纹上抓取, 然后合并结果 。 您可以使用 git 抓取时查看远程分支是否有更新, 而不必将其与您的本地分支合并 。