学会看文档 man git-pull
:
DESCRIPTION
Incorporates changes from a remote repository into the current branch. In its default mode, git pull is shorthand for git fetch followed by git merge FETCH_HEAD.
More precisely, git pull runs git fetch with the given parameters and calls git merge to merge the retrieved branch heads into the current branch. With --rebase, it runs git rebase instead of git merge.
可以看到:
- 变更合并到当前分支
- 默认情况等价于
git fetch
+ git merge FETCH_HEAD
(有默认自然有其他选项,这些要继续看文档)
其他分支会怎样?因为执行了 git fetch
,其他分支的信息会拉取回来,但没有合并,所以会看到和远端的差异:
$ git checkout other-branch
Your branch is behind 'origin/other-branch' by 4 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
自己实践,看文档,可能比 SF 提题要快。
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…