How to fetch all Git branches

后端 未结 30 1603
情书的邮戳
情书的邮戳 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 09:58

    Based on the answer by Learath2, here's what I did after doing git clone [...] and cd-ing into the created directory:

    git branch -r | grep -v master | awk {print\$1} | sed 's/^origin\/\(.*\)$/\1 &/' | xargs -n2 git checkout -b

    Worked for me but I can't know it'll work for you. Be careful.

提交回复
热议问题