0

How to create local branches for all the remote branches available

I can able to create a local branch from a remote branch one by one.

Is there any command available to create local branches from all the remote branches available.

(example: i have 50 branches in remote, i wants to create 50 local branches for those remote branches)

Pandiyan Cool
  • 6,381
  • 8
  • 51
  • 87
  • 1
    possible duplicate of [Track all remote git branches as local branches](http://stackoverflow.com/questions/379081/track-all-remote-git-branches-as-local-branches) – nwinkler Feb 18 '15 at 11:59
  • 1
    What for? Maybe there is a simpler way of whatever you are trying to achieve? – Sascha Wolf Feb 18 '15 at 12:06

1 Answers1

-1

UPDATED

This may not work - git post-1.9.1

Using bash:

for remote in `git branch -r `; do git branch --track $remote; done

Update the branches, assuming there are no changes on your local tracking branches:

for remote in `git branch -r `; do git checkout $remote ; git pull; done

Ignore the ambiguous refname warnings, git seems to prefer the local branch as it should.

refer this : Track all remote git branches as local branches

backtrack
  • 7,996
  • 5
  • 52
  • 99
  • Watch out: this answer is broken for git post-1.9.1, and will create a mess of local branches, all incorrectly tracking master – minexew Apr 10 '21 at 20:01