How to fetch all Git branches

后端 未结 30 1552
情书的邮戳
情书的邮戳 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:07

    Make sure all the remote branches are fetchable in .git/config file.

    In this example, only the origin/production branch is fetchable, even if you try to do git fetch --all nothing will happen but fetching the production branch:

    [origin]
    fetch = +refs/heads/production:refs/remotes/origin/production
    

    This line should be replaced by:

    [origin]
    fetch = +refs/heads/*:refs/remotes/origin/*
    

    Then run git fetch etc...

提交回复
热议问题