1

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 ?

piet.t
  • 11,718
  • 21
  • 43
  • 52
Afsanefda
  • 3,069
  • 6
  • 36
  • 76
  • 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 Answers2

3

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).

Romain Valeri
  • 19,645
  • 3
  • 36
  • 61
1

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.

choroba
  • 231,213
  • 25
  • 204
  • 289