Reputation: 2563
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
Upvotes: 0
Views: 56
Reputation: 14599
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.
Upvotes: 3
Reputation: 9
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
Upvotes: -1