Track all remote git branches as local branches

前端 未结 15 2411
佛祖请我去吃肉
佛祖请我去吃肉 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:37

    Using bash, If you want to checkout all branches:

    for remote in `git branch -r`; do git checkout $(echo $remote | cut -d'/' -f 2); done
    

    It’s important to note that when you do a fetch that brings down new remote-tracking branches, you don’t automatically have local, editable copies of them.

提交回复
热议问题