当前回答
其他回答
之间唯一的差别git pull
和git fetch
是:
git pull
从远程分支拉出并合并。
git fetch
仅从远程分支获取取取, 但它不合并
i. e. git pull = git 获取 + git 合并...
git pull = = (获取 Git + git 合并)
git refick 不改变本地分支 。
如果您已经拥有一个本地仓库, 并且为所要的工程设置了远程设置, 您可以使用 git 抓取, 来抓取所有现有的远程的分支和标记 。... Fetch 不改变本地分支 。 因此您需要将远程分支与本地分支合并, 以纳入新抓取的更改 。发自 Github
最简单的说,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 - 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" ,因为有人一直在标记 一些文章在这里。
推荐文章
- Windows git“警告:LF将被CRLF取代”,这是警告尾巴向后吗?
- git中的哈希冲突
- git可以自动在空格和制表符之间切换吗?
- Git暂存文件列表
- 如何将git配置存储为存储库的一部分?
- 如何修改GitHub拉请求?
- 如何在Github和本地删除最后n次提交?
- 我如何调试git/git-shell相关的问题?
- 错误:无法使用rebase进行拉取:您有未分阶段的更改
- Git隐藏未缓存:如何把所有未分期的变化?
- 真实的恶魔
- 如何从另一个分支获得更改
- Git:权限被拒绝(publickey)致命-无法从远程存储库读取。克隆Git存储库时
- git reflog和log有什么区别?
- git推挂在Total line之后