How to fetch all Git branches

后端 未结 30 1019
情书的邮戳
情书的邮戳 2020-11-22 09:38

I cloned a Git repository, which contains about five branches. However, when I do git branch I only see one of them:

$ git branch
* master
         


        
30条回答
  •  情歌与酒
    2020-11-22 10:15

    Set alias: (based on the top answer)

    git config --global alias.track-all-branches '!git fetch --all && for remote in `git branch -r`; do git branch --track ${remote#origin/} $remote; done && git fetch --all'
    

    Now to track all the branches:

    git track-all-branches

提交回复
热议问题