开发者

Specifying a branch in git fetch

What does the branch parameter mean when issuing

git fetc开发者_如何转开发h <remote_repo> <branch>

?


The branch parameter is the name of the branch in your that you are going to fetch.

See an example in the git docs: http://www.kernel.org/pub/software/scm/git/docs/git-fetch.html

git fetch origin +pu:pu maint:tmp

This updates (or creates, as necessary) branches pu and tmp in the local repository by fetching from the branches (respectively) pu and maint from the remote repository.

The pu branch will be updated even if it is does not fast-forward, because it is prefixed with a plus sign; tmp will not be.


You should read the manual for questions like this. To answer your question, "git fetch < remote_repo>" will fetch all the of the remote branches you have configured for that repo. This is controlled by the entry for that repo in .git/config. Adding "< branch>" fetches only one branch, which might not even be one that you are remote tracking.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜