How do you clean up old branches automatically?
Old branches can clutter your repo. You can clean them locally and remotely.
Commands:
To delete merged branches locally:
git branch --merged main | grep -v "main" | xargs git branch -d
To prune deleted remote branches:
git fetch --prune
Example:
After several months, your repo has 50 old feature branches. You can prune them
automatically in CI or periodically with these commands.