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

后端 未结 10 1720
無奈伤痛
無奈伤痛 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:56

    All you need to do is to run this command:

    git remote prune origin
    

    Something extra that you can do, because it's annoying sometimes to open a terminal just for that.. you can add a task in vscode.

    To do that please make follow these steps:

    1. In VSCode View > Command Palette (cmd/ctrl + Shift + P)
    2. type Configure Task
    3. Select Create tasks.json file from template and a new file will be created under .vscode folder.
    4. Inside tasks array add this:

    { "label": "Git Prune", "type": "shell", "command": "git remote prune origin", "problemMatcher": [] }

    How to use it:

    1. Open Command Palette
    2. Type Run Task and select it
    3. Select Git Prune

    Reference:

    1. Git prune

提交回复
热议问题