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


当前回答

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

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

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

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

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

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

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

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

其他回答

Git允许在较新的承诺之后适用按时间顺序排列的旧承诺。 因此,存放库之间转移承诺的行为分为两步:

从远程分机复制新承诺副本到本地分机内的远程分机 。 (repo to repo operation) 主机@ remote {% text/ text/ text/ text/ progin/ master@ local 集成新承诺给本地分机( 内部分机操作) 远程/ text/ master@ local

第二步有两种方法,你可以:

在上一个共同祖先之后, 将本地分支方叉, 并添加与本地仓库独特的承诺平行的新承诺, 最终通过合并承诺完成, 关闭叉子 。 在上次共同祖先后插入新承诺, 并重新应用本地仓库独有的承诺 。

在 Git 术语中, 第1 步是 Git 抓取, 第 2 步是 Git 合并或 Git 重新基准

git pull 是 Git 抓取和 Git 合并

您可以从远程仓库获取, 查看差异, 然后拉动或合并 。

这是被称作起源的远程存储库和名为“跟踪远程分支来源/主管”的分支的分支的一个例子:

git checkout master                                                  
git fetch                                        
git diff origin/master
git rebase origin master
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 pull 是一个 Git 抓取, 然后是 git 合并 。


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

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

Git Pull 的 Git 文档 :

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

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