0

Possible Duplicate:
Is it possible to clone git config from remote location?

As in the title, How do I clone repos and track all remote branches automatically at once?

When I clone remote repos, it only tracks origin/master, then I need to track other remote branches manually. Is there any way to do this automatically?

Community
  • 1
  • 1
Robber Pen
  • 1,033
  • 2
  • 12
  • 24

1 Answers1

0

Not quite getting the question, but...

When you clone, you do have access to all the branches, they are there in origin.

To look at one git checkout other_branch_name

If those branches then get updated on the server you just need to do a git fetch to get all the latest versions plus any new branches that have been added.

git fetch will place them in origin/ only. They won't be merged into your current branches until and unless you do a git merge (or a git pull which does a fetch AND a merge - but I'm avoiding that mostly these days as it's pretty dangerous if you lose focus about what's what).

Michael Durrant
  • 93,410
  • 97
  • 333
  • 497
  • Thanks, I know your method by `git co` after clone. But how about if they are many branches in repo. I have to try many times `git checkout ` for each remote branch, right? – Robber Pen Dec 19 '12 at 15:28
  • You do git checkout branchname. No origin. This command is telling git to get the branch from tracking (origin) and make it your local development branch. – Michael Durrant Dec 19 '12 at 16:16