当前回答
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
是否为 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 pull --rebase
以上命令是我生命中最有用的命令 挽救了很多时间
在将您的新承诺推进到服务器之前, 请尝试此命令, 它会自动同步最新的服务器更改( 加上一个抓取 + 合并) , 并将您的承诺放在 Git 日志的顶部 。 无需担心手动拉动/ 合并 。
其中一个使用实例git fetch
是,以下将告诉您自您上次拉动以来远程分支的任何变化... 这样您就可以在实际拉动之前检查, 这样就可以改变您当前分支和工作副本中的文件 。
git fetch
git diff ...origin
见见git diff
双- 双- 双- 双- 双- 双- 双- 双- 双- 双- 双- 双- 双- 双- 双- 双- 双- 双- 双- 双- 双- 双- 双- 双- 双- 双- 双- 双- 双..
三点和三点...
语法。
我们简单地说:
git pull == git fetch + git merge
如果你逃跑git pull
中,您不需要将数据合并到本地数据。如果运行git fetch
这意味着你必须跑git merge
获取本地机器的最新代码。 否则, 本地机器代码不会在不合并的情况下被更改 。
所以在 Git Gui 中, 当您获取时, 您必须合并数据 。 获取本身不会在本地修改代码 。 您可以检查当您通过一次获取并查看来更新代码时, 是否更新了代码; 代码不会改变 。 然后您将合并... 您将会看到修改后的代码 。
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" ,因为有人一直在标记 一些文章在这里。
推荐文章
- 如何查看一个分支中的哪些提交不在另一个分支中?
- 如何取消在github上的拉请求?
- HEAD和master的区别
- GIT克隆在windows中跨本地文件系统回购
- RPC失败;卷度传输已关闭,剩余未完成的读取数据
- 我应该在.gitignore文件中添加Django迁移文件吗?
- 错误:您对以下文件的本地更改将被签出覆盖
- Git rebase—即使所有合并冲突都已解决,仍然会继续报错
- 在Git中,我如何知道我的当前版本是什么?
- 跟踪所有远程git分支作为本地分支
- 为什么要把Gradle Wrapper提交给VCS?
- 自定义SSH端口上的Git
- git如何显示不存在于.gitignore中的未跟踪文件
- Git错误:遇到7个文件应该是指针,但不是
- GitHub克隆与OAuth访问令牌