Search code examples
gitgit-branchgit-fetch

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 ?


Solution

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