Git
Clean up merged Git branches
Fetch the latest remote state, then remove local branches that are already merged into main.
The current branch and the main branch are kept. Change main in the command if your default
branch uses a different name.
git fetch --prune
git branch --merged main \
| grep -Ev '^\*|^[[:space:]]*main$|^[[:space:]]*master$' \
| xargs -r -n 1 git branch -d