我有一个父分支 origin/develop
,从这个分支我创建了一个子分支 feature/NewFeatureBranch
我现在在 feature/NewFeatureBranch
上使用 git checkout feature/NewFeatureBranch
现在我已经完成了 git pull
并且可以看到几个新的分支下载到我的本地机器上,它们的父节点都是 develop
在另一个场景中,我已经完成了 git pull origin develop
,在这种情况下,从其他分支向 develop
新签入的文件正在下载。
git pull
表现得像 git fetch
而 git pull origin develop
表现得像 git fetch + git merge
也是如此。
答案 0 :(得分:1)
文档的第一句话:
<块引用>在默认模式下,git pull 是 git fetch
后跟 git merge FETCH_HEAD
的简写。
所以 git pull
只是一个简写。 Git 对您的意思做了一些假设并提供了缺失的部分。因此,默认情况下它的简写是:
git fetch
git merge <remote-tracking-branch-that-current-branch-tracks> [into the current branch]
同样,如果你真的给了一个遥控器和一个分支,你仍然说:
git fetch remote
git merge remote/branch [into the current branch]
您可以更改简写的含义(作为 config
设置的一部分),例如更改为 rebase
而不是 merge
,但大多数人不这样做。一般而言,有些人认为最好不要说 git pull
,而是说 fetch
,然后,如果需要,可以说 merge
或 rebase
或其他什么,明确。这让您有机会“环顾四周”并决定如何继续。