So you’ve done a lot of work in feature branches, pushed those branches to the remote, and they’ve been merged back into main. But now you’ve got a bunch of local branches which you don’t need anymore.
This will clear out all local branches which have already been merged into main
:
git branch | grep -v main | xargs git branch -d
If you want to KILL THEM ALL, even those which have not been merged, change change the last bit to xargs get branch -D
.