Track all remote git branches as local branches

前端 未结 15 2370
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-22 09:01

Tracking a single remote branch as a local branch is straightforward enough.

$ git checkout --track -b ${branch_name} origin/${branch_name}
<
15条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 09:39

    To do the same as tjmcewan's answer but on Windows, call this from a batch file:

    for /f "delims=" %%r in ('git branch -r ^| grep -v master') do git checkout --track %%r
    

    Or this from the command line:

    for /f "delims=" %r in ('git branch -r ^| grep -v master') do git checkout --track %r
    

提交回复
热议问题