Afsanefda
Afsanefda

Reputation: 3339

Can not fetch all git branches

I've recently installed git on my MacBook for the first time. I generate my ssh key and added it to my git account. I cloned with ssh remote and after cloning I tried to fetch all branches with git fetch --all but after running this command nothing happens and I still have just the master branch. Do you think my installation has some problem (my git configuration ) or it is some thing else ?

Upvotes: 1

Views: 216

Answers (2)

Romain Valeri
Romain Valeri

Reputation: 21998

No, it's the expected behaviour.

Your fetch has retrieved locally all the remote branches as remote-tracking branches, but no local branches have been automatically created from the get go.

To see remote branches, try git branch -r

To create a local version of, say, development remote branch, just check it out and it will be created with a default link to its remote counterpart. If you saw origin/development in the list generated above with -r, just

git checkout development

and it will then appear in your branch list (without -r or -a).

Upvotes: 3

choroba
choroba

Reputation: 241918

git fetch doesn't change the current branch, it only fetches the information about remote branches. You need to checkout a branch to switch to it. Run gitk --all, git branch -r, or git log --oneline --graph --decorate --all to see all the remote branches.

Upvotes: 1

Related Questions