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

1

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

stackoverflow.com/a/20783081/2615428 Something similar, worked for me.. Thanks
-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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.