some confusion on git pull vs git
This question already has an answer here:
The "ahead or behind by X commits" text in git status
is based on the state of the tracking branch for the current branch; remotes/origin/master
if you're on master
, for example.
When you run git pull
with both a remote and a branch specified, it fetches the new commits and merges them in to the current branch, but it does not update origin's remote tracking branches. Instead, it points to the just-fetched commits as FETCH_HEAD
.
Running git fetch
with no arguments specified, on the other hand, does update all of the remote tracking branches, so it makes the message go away. git pull
with no arguments does the same.
A subtle gotcha that I've hit a bunch of times myself! I wish git updated all remote tracking branches on every fetch against a particular remote, instead.
链接地址: http://www.djcxy.com/p/1196.html上一篇: 为什么不git获取更新本地分支?
下一篇: git pull vs git有些混乱