Track all remote git branches as local branches

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

    From git 2.23 onwards:

    for branch in `git branch -r | grep origin/`; do git switch -t -C ${branch#origin/} $branch; git pull; done
    

    The -C flag for git switch creates or resets if it already exists.

    git switch documentation

提交回复
热议问题