Phillip
Phillip

Reputation: 5676

Specifying a branch in git fetch

What does the branch parameter mean when issuing

git fetch <remote_repo> <branch>

?

Upvotes: 0

Views: 153

Answers (2)

Brian
Brian

Reputation: 188

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.

Upvotes: 2

Spike Gronim
Spike Gronim

Reputation: 6182

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.

Upvotes: 0

Related Questions