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. <
I interpreted the question to be: how can I delete my local branches that have been merged, since I've been using Git Fetch (Prune) from the command palette. This may be considered a "hack", but it's what I use. In the PowerShell terminal:
$branches = (git branch --merged).replace(" ", "").replace("*", "") | ? { $_ -ne "develop" -and $_ -ne "master" }
foreach ($branch in $branches) { git branch $branch -d }
In case you're not familiar with PoSH, here's what that does: the first line gets the name of all merged branches (with the exception of develop and master), and the second line loops through that list and runs "git branch -d". As long as the branch is merged completely, you should see:
Deleted branch (was ).
for each branch. Occasionally I'll run into a branch that fails to be deleted - if this happens, and you're sure that it's safe to be deleted (i.e. you won't lose local work that hasn't been stored), you can run:
git branch -D
Note the capital D - that forcibly deletes the local branch.