How do I list all remote branches in Git 1.7+?

后端 未结 19 2280
轮回少年
轮回少年 2020-12-02 03:14

I\'ve tried git branch -r, but that only lists remote branches that I\'ve tracked locally. How do I find the list of those that I haven\'t? (It doesn\'t matter

19条回答
  •  暖寄归人
    2020-12-02 04:05

    Using git branch -r lists all remote branches and git branch -a lists all branches on local and remote. These lists get outdated though. To keep these lists up-to-date, run

    git remote update --prune
    

    which will update your local branch list with all new ones from the remote and remove any that are no longer there. Running this update command without the --prune will retrieve new branches but not delete ones no longer on the remote.

    You can speed up this update by specifying a remote, otherwise it will pull updates from all remotes you have added, like so

    git remote update --prune origin
    

提交回复
热议问题