Member-only story
Git cleanup: delete local branches deleted on a remote
Jul 13, 2021
- Prune deleted remotes:
git fetch --prune
2. Identifying “gone” branches and delete them:
git for-each-ref --format '%(refname:short) %(upstream:track)' | awk '$2 == "[gone]" {print $1}' | xargs -r git branch -D