How do I fetch back all the branches for my repository on Git? I tried the following:
git remote add origin git@github.com:anchetaWern/Zenoir-Online-Classroom.git
git pull git@github.com:anchetaWern/Zenoir-Online-Classroom.git
I have 3 branches in that repository but now I only have the master branch. How do I pull back the other 2?
After you do the 'git remote add origin the-repo' just perform a 'git fetch -a origin' at which point all the branches are there and ready to be checked out. Here is a typical workflow:
$ git init
Initialized empty Git repository in /Users/ebg/test/dev5/.git/
$ git remote add origin /Users/ebg/test/dev1
$ git fetch -a origin
remote: Counting objects: 41, done.
remote: Compressing objects: 100% (30/30), done.
remote: Total 41 (delta 15), reused 0 (delta 0)
Unpacking objects: 100% (41/41), done.
From /Users/ebg/test/dev1
* [new branch] add-on -> origin/add-on
* [new branch] master -> origin/master
$ git checkout add-on
Branch add-on set up to track remote branch add-on from origin.
Switched to a new branch 'add-on'
So, for this example, branch 'add-on' is now in the working directory and 'git checkout master' will get files from the remote 'origin' if needed.