Visual Studio Code - remove branches deleted on GitHub that still show in VS Code?

后端 未结 10 1532
無奈伤痛
無奈伤痛 2021-01-29 20:50

In VSCode, after I do a pull request and delete the branch on GitHub, that branch still shows up in Visual Studio Code. If I select the branch, it gives an Error, as expected. <

10条回答
  •  再見小時候
    2021-01-29 20:57

    You can remove all the local branches (except master) with:

    git branch -r | grep -v "master" | xargs git branch -D
    

    And you can remove all the branches still appearing as origin/XXXX in VSCode but already deleted in origin with:

    git fetch --prune
    

    Note:

    The first command above (taken from https://stackoverflow.com/a/52006270/3120163):

    • list all the branches
    • remove the master branch from the list
    • delete the branches in the list

提交回复
热议问题