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+               -
---------------------     -----------------------     -----------------------

这帮助我理解了为什么买东西很重要。