简体   繁体   中英

how to create local branches for all remote branches in GIT

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)

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM