A simple powershell script to clean up local branches that have been merged to main:
git branch --merged main | Foreach-object { if($_.SubString(0,1) -ne '*'){ git branch -d $_.SubString(2);} }Delete branches that have been removed in origin
git remote prune originDelete branches other than current
git branch | Foreach-object { if($_.SubString(0,1) -ne '*'){ git branch -d $_.SubString(2);} }Force delete branches other than current
git branch | Foreach-object { if($_.SubString(0,1) -ne '*'){ git branch -D $_.SubString(2);} }