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


当前回答

这种交互式图形表达方式非常有助于低估数据:http://ndpsoftware.com/git-cheatesheet.html。

git 获取从远程到本地仓库的更改时只“ 下載 ” 。 git 下载这些更改并将其合并到当前的分支中。 “ 在默认模式中, git 拖动是 Git 获取的简称, 然后是 Git 合并 FETCH_HEAD 。 ”

其他回答

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 pull 用于不同的目的: 以远程服务器的最新更改更新您当前的 HEAD 分支。 这意味着不仅下载新数据, 还会直接将其整合到您当前的工作副本文件中 。

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


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

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

Git Pull 的 Git 文档 :

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

Git pull 和 Git fick 之间唯一的区别是:

git 拉从远程分支拉拉并合并。

git 只从远程分支获取从远程分支获取的抓取, 但不会合并

i. e. git pull = git 获取 + git 合并...

Git使用两个命令从远程到本地获取最新版本的分支 :

git 获取 : Git 会从远程获取最新版本到本地版本, 但不会自动合并 。 git 获取来源母版 master git log -p master. 来源/ master git 合并来源/ master 。 上面的命令意味着从远程下载主分支的最新版本, 从原始到来源母分支。 然后比较本地主分支和源母母分支。 最后, 合并 。 git pull : Git 会从远程获取最新版本并合并到本地 。 git pull 源母版 。 上面的命令相当于 git 获取和 git 合并 。 在实践中, git 获取可能更安全一些, 因为合并前我们可以看到这些修改并决定是否合并 。