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" ,因为有人一直在标记 一些文章在这里。
其他回答
我也为此挣扎过。事实上,我来到这里时,用谷歌搜索了完全相同的问题。阅读了所有这些答案,终于在我脑海中画出了一张图片,我决定试着从下面看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 pull
将会从仓库获取代码 并重新基础与您的本地... 在git拉动中,有 可能性创造新的承诺。
但是在,
git 获取 git 获取
将会从存储库获取代码, 我们需要使用 Git 重新基准来手动重标
eg: 我要从服务器主机取回它, 并在本地主机重标 。
1) git pull( 重基将自动完成) :
git pull origin master
这里的起源是您的远程回购主人 您的分支是您的远程回购主人
2) git 获取( 需要手动重标) :
git fetch origin master
它会从源代码中获取服务器更改。 它会位于本地, 直到您自己重新定位它。 我们需要通过检查代码手动来修正冲突 。
git rebase origin/master
这将会将代码重设为本地代码。 在确保您在正确的分支之前。
git pull = git fetch + git merge
git 将代码从远程服务器拖动到您本地仓库的跟踪分支。 如果您的远程代码被命名为源代码( 默认) , 这些分支将位于源代码/ 内, 例如源代码/ 源代码/ 主管、 源代码/ mybranch-123 等 。 这些不是您当前的分支, 它们是服务器上这些分支的本地副本 。
git pull 进行 git 抓取, 但也同时将代码从跟踪分支合并到您当前本地版本的分支中。 如果您还没有准备好修改, 请先拨入 。
推荐文章
- 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之后