SamJolly
SamJolly

Reputation: 6487

Why am I not seeing git branch after a git fetch?

I have just done :

git fetch origin feature/myfeature

I would expect to see in my local branches when I issue:

git branch

But strangely I cannot see the fetched branch, which was successful. Am I misunderstanding something?

Upvotes: 2

Views: 135

Answers (4)

Kenny Tai Huynh
Kenny Tai Huynh

Reputation: 1599

Can you use git show-branch --all?! All detail are here: https://git-scm.com/docs/git-show-branch

Upvotes: 2

mic4ael
mic4ael

Reputation: 8320

While fetching you can specify a branch that should be created locally

git fetch origin <remote_branch>:<local_branch> 

When fetching, all the branches should be visible when you issue git branch -a or git branch -r

Upvotes: 1

Michał Walenciak
Michał Walenciak

Reputation: 4369

From git's manual:

If --list is given, or if there are no non-option arguments, existing branches are listed; the current branch will be highlighted with an asterisk. Option -r causes the remote-tracking branches to be listed, and option -a shows both local and remote branches.

Upvotes: 1

Roman Marusyk
Roman Marusyk

Reputation: 24619

Because git branch shows only local branches. Use git branch -a to see both local and remote branches or git branch -r to see only remote branches

Upvotes: 1

Related Questions