Tidying up git branches
It's easy to tidy up branches which have been deleted on a remote using the prune switch on git fetch, e.g.:
git fetch --all --prune
but deleting the corresponding local branches is less convenient.
Until today, I used git branch to spot local branches and then:
git branch -d branch-name
to delete them, one at a time.
But today I found this solution on stackoverflow which deletes all local branches that have been merged into main:
git branch --no-contains main --merged main | xargs git branch -d