Delete local Git branches after deleting them on the remote repo

前端 未结 12 2007
死守一世寂寞
死守一世寂寞 2020-11-30 16:26

I want to have my local and remote repositories always in sync in terms of branches.

After a Pull Request review on GitHub, I merge and remove my branch there (remot

12条回答
  •  执念已碎
    2020-11-30 17:10

    For people using powershell, this is the equivalent to the answer above:

    git branch -vv | Select-String -Pattern ': gone]' | ForEach-Object{($_ -split "\s+")[1]} | %{ git branch -D $_ }
    
    1. Filter all the branches that are marked as gone
    2. Call git branch -D on each of the found branches

提交回复
热议问题