Housekeeping Git Branches
Clean up local branches
List all local:
git branch
List merged:
git checkout main git branch --merged
Remove all outdated branches with:
git branch -d <old-merged>
List not merged:
git branch --no-merged
Force remove abandoned (careful!):
git branch -D <old-abandoned>
Clean up references to remote branches
List all remote:
git branch -r
Prune staled remote branches:
git fetch -p