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 ?
-
Possible duplicate of [git fetch origin doesn't fetch all branches](https://stackoverflow.com/questions/22022106/git-fetch-origin-doesnt-fetch-all-branches) – phd Jun 20 '19 at 09:38
-
https://stackoverflow.com/search?q=%5Bgit-fetch%5D+all+branches – phd Jun 20 '19 at 09:38
2 Answers
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
).

- 19,645
- 3
- 36
- 61
-
-
It create a counterpart in the local repo, linked to the remote one by ways of pulling and pushing. – Romain Valeri Jun 20 '19 at 07:06
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.

- 231,213
- 25
- 204
- 289
-
But at least I can see the branches by running git branch. Is it right ? – Afsanefda Jun 20 '19 at 06:08
-