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


当前回答

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

其他回答

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 checkout master                                                  
git fetch                                        
git diff origin/master
git rebase origin master

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

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

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

Git 获取

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

基特合并

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

吉特拉拉

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