0

How can I pull all the git branch of my repository.

I tried this and this question's few answers, but doesn't seem to do the job for me.

There are three branches, but when I do

git branch

It only shows the master branch.

git branch -a

gives this output

 * master
  origin/HEAD
  origin/development
  origin/feature1
  origin/master
  remotes/origin/HEAD -> origin/master
  remotes/origin/development
  remotes/origin/feature1
  remotes/origin/master

So, I am unable to checkout to feature1 branch and hence cannot check the code residing at the feature1

Please help

Community
  • 1
  • 1
Suraj
  • 2,083
  • 8
  • 30
  • 65
  • possible duplicate of [How to fetch all git branches](http://stackoverflow.com/questions/10312521/how-to-fetch-all-git-branches) – amphetamachine May 20 '15 at 15:33

2 Answers2

3

When you do git fetch, you actually retrieve all the branches of the remote repository (you can do git fetch --all if you have several remote repositories)

If git branch -a gives you

* master
origin/HEAD
origin/development
origin/feature1
origin/master
remotes/origin/HEAD -> origin/master
remotes/origin/development
remotes/origin/feature1
remotes/origin/master

and you're interested in feature1, then you just need to do git checkout origin/feature1. Now you can even do git branch feature1 if you want a local branch.

gturri
  • 10,843
  • 9
  • 35
  • 53
-1

I have used the git in one of my projects.
Step 1: Do checkout for all the branches as source (i.e., at repository level).
Step 2: Next time while pulling the repository to some other site will bring all those branches.

You can switch to any branch by checkout command from the pulled repository.

Hope this would solve your problem. Amol