Git pull 和 Git fick 之间有什么区别?
当前回答
git pull 命令其实是 Git 抓取的快捷键, 后面是 git 合并或 git 重设命令, 取决于您的配置 。 您可以配置您的 Git 仓库, 这样 git pull 是一个抓取, 后面是重置 。
其他回答
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 fetch + git merge
Git 获取
帮助您从 Git 仓库获取最新更新信息 。 假设您在一个使用 GitFlow 的团队中工作, 该团队在多个分支( 功能) 上工作 。 有了 Git 抓取 -- 所有的指令, 您都可以了解仓库中所有新的分支 。
多数情况下, git 抓取程序都与 git 重置一起使用。 例如, 您想要将全部本地更改恢复到当前仓库状态 。
git fetch --all // get known about latest updates
git reset --hard origin/[branch] // revert to current branch state
Git 拉着
此命令以当前仓库分支状态更新您的分支处 。 让我们继续使用 GitFlow 。 多个特性分支已被合并来开发分支, 当您想要为项目开发新特性时, 您必须前往开发分支处, 并做一个 Git pull 以获取当前开发分支的状态
GitFlow 的文件 https://gist.github.com/peterdeweese/4251497
Git pull 和 Git fick 之间唯一的区别是:
git 拉从远程分支拉拉并合并。
git 只从远程分支获取从远程分支获取的抓取, 但不会合并
i. e. git pull = git 获取 + git 合并...
我也为此挣扎过。事实上,我来到这里时,用谷歌搜索了完全相同的问题。阅读了所有这些答案,终于在我脑海中画出了一张图片,我决定试着从下面看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+ -
--------------------- ----------------------- -----------------------
这帮助我理解了为什么买东西很重要。
推荐文章
- “node_modules”文件夹应该包含在git存储库中吗
- 为什么git-rebase给了我合并冲突,而我所做的只是压缩提交?
- 当我试图推到原点时,为什么Git告诉我“没有这样的远程‘原点’”?
- 如何从远程分支中挑选?
- 如何查看一个分支中的哪些提交不在另一个分支中?
- 如何取消在github上的拉请求?
- HEAD和master的区别
- GIT克隆在windows中跨本地文件系统回购
- RPC失败;卷度传输已关闭,剩余未完成的读取数据
- 我应该在.gitignore文件中添加Django迁移文件吗?
- 错误:您对以下文件的本地更改将被签出覆盖
- Git rebase—即使所有合并冲突都已解决,仍然会继续报错
- 在Git中,我如何知道我的当前版本是什么?
- 跟踪所有远程git分支作为本地分支
- 为什么要把Gradle Wrapper提交给VCS?