当前回答
最简单的说,git pull
是否为 a 的git fetch
续 续 agit merge
.
git fetch
更新您的远程跟踪分支refs/remotes/<remote>/
。此操作可以随时安全运行,因为它不会改变您在refs/heads
.
git pull
本地分支提供其远程版本的最新信息,同时更新其他远程跟踪分支。
调自 Git 文档git pull
:
git pull
运行中git fetch
使用给定参数,然后取决于配置选项或命令行的旗帜,将调用其中之一git rebase
或git merge
以便各处之间互相调和。
有必要记住,在任何特定机器的Git存储库工作时,存储库载有来自所有远程的所有分支的复制件,以及每个地方分支的复制件,你已经做了一些工作。
你可以看到这个使用git branch -a
显示您所在的分支机构,包括master
和所有遥控器的分支。
master
feature/my-feature-branch
remotes/origin/master
remotes/origin/my-feature-branch
remotes/another-remote-machine/master
remotes/another-remote-machine/my-feature-branch
上面我已指出 遥控遥控器的存在origin
以另一个名称返回和另一个远程another-remote-machine
.
注意 您不必在所有仓库中拥有每个分支的复制件 。 (remotes 和 local.) 它取决于您通过运行同步 。git pull
, git push
, git fetch
,来自不同的机器 / 仓库 所涉及的。
其他回答
简单解释:
git fetch
获取元数据。 如果您想要检查最近创建的分支, 您可能需要在退出前进行获取 。
git pull
从远程获取元元数据,并将文件从远程移动并合并到分支
最简单的说,git pull
是否为 a 的git fetch
续 续 agit merge
.
git fetch
更新您的远程跟踪分支refs/remotes/<remote>/
。此操作可以随时安全运行,因为它不会改变您在refs/heads
.
git pull
本地分支提供其远程版本的最新信息,同时更新其他远程跟踪分支。
调自 Git 文档git pull
:
git pull
运行中git fetch
使用给定参数,然后取决于配置选项或命令行的旗帜,将调用其中之一git rebase
或git merge
以便各处之间互相调和。
有必要记住,在任何特定机器的Git存储库工作时,存储库载有来自所有远程的所有分支的复制件,以及每个地方分支的复制件,你已经做了一些工作。
你可以看到这个使用git branch -a
显示您所在的分支机构,包括master
和所有遥控器的分支。
master
feature/my-feature-branch
remotes/origin/master
remotes/origin/my-feature-branch
remotes/another-remote-machine/master
remotes/another-remote-machine/my-feature-branch
上面我已指出 遥控遥控器的存在origin
以另一个名称返回和另一个远程another-remote-machine
.
注意 您不必在所有仓库中拥有每个分支的复制件 。 (remotes 和 local.) 它取决于您通过运行同步 。git pull
, git push
, git fetch
,来自不同的机器 / 仓库 所涉及的。
Git允许在较新的承诺之后适用按时间顺序排列的旧承诺。 因此,存放库之间转移承诺的行为分为两步:
正在从远程分支复制新承诺, 复制本地副本中的此远程分支 。
(收回业务)
master@remote >> remote/origin/master@local
整合对地方分支机构的新承诺
(内购外业务)
remote/origin/master@local >> master@local
第二步有两种方法,你可以:
- 在上一个共同祖先之后,将本地分支叉到叉口,并添加与本地仓库独特的承诺平行的新承诺,通过合并承诺最终完成,关闭叉口。
- 在上一个共同祖先后插入新承诺,并重新应用本地仓库独有的承诺。
内git
术语术语,第1步是git fetch
,第2步是git merge
或git rebase
git pull
是git fetch
和git merge
我也为此挣扎过。事实上,我来到这里时,用谷歌搜索了完全相同的问题。阅读了所有这些答案,终于在我脑海中画出了一张图片,我决定试着从下面看2个储存库和1个沙箱的状况,以及一段时间以来在看它们的版本时所采取的行动。这就是我所想出来的。如果我在任何地方搞砸了,请纠正我。
三个邮箱有一个接听器:
--------------------- ----------------------- -----------------------
- Remote Repo - - Remote Repo - - Remote Repo -
- - - gets pushed - - -
- @ R01 - - @ R02 - - @ R02 -
--------------------- ----------------------- -----------------------
--------------------- ----------------------- -----------------------
- Local Repo - - Local Repo - - Local Repo -
- pull - - - - fetch -
- @ R01 - - @ R01 - - @ R02 -
--------------------- ----------------------- -----------------------
--------------------- ----------------------- -----------------------
- Local Sandbox - - Local Sandbox - - Local Sandbox -
- Checkout - - new work done - - -
- @ R01 - - @ R01+ - - @R01+ -
--------------------- ----------------------- -----------------------
三号邮局拉一拉一拉
--------------------- ----------------------- -----------------------
- Remote Repo - - Remote Repo - - Remote Repo -
- - - gets pushed - - -
- @ R01 - - @ R02 - - @ R02 -
--------------------- ----------------------- -----------------------
--------------------- ----------------------- -----------------------
- Local Repo - - Local Repo - - Local Repo -
- pull - - - - pull -
- @ R01 - - @ R01 - - @ R02 -
--------------------- ----------------------- -----------------------
--------------------- ----------------------- -----------------------
- Local Sandbox - - Local Sandbox - - Local Sandbox -
- Checkout - - new work done - - merged with R02 -
- @ R01 - - @ R01+ - - @R02+ -
--------------------- ----------------------- -----------------------
这帮助我理解了为什么买东西很重要。
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添加?
- Rubymine:如何让Git忽略Rubymine创建的.idea文件
- Gitignore二进制文件,没有扩展名
- Git隐藏错误:Git隐藏弹出并最终与合并冲突
- 了解Git和GitHub的基础知识
- 没有。Git目录的Git克隆
- Git与Mercurial仓库的互操作性
- 忽略git中修改(但未提交)的文件?
- “git restore”命令是什么?“git restore”和“git reset”之间有什么区别?
- Git合并与强制覆盖
- Git拉另一个分支
- 在Bash命令提示符上添加git分支
- 如何更改Git日志日期格式
- git pull -rebase和git pull -ff-only之间的区别