Skip to content

Latest commit

 

History

History
9 lines (6 loc) · 510 Bytes

delete-all-local-dead-branches.md

File metadata and controls

9 lines (6 loc) · 510 Bytes

delete all local dead git branches

delete all local (dead) branches -- i.e, the branches which are deleted (merged) in remote, but present locally

NOTE: this assumes you have a script pullallbranches.sh, which pulls alls remote branches

git pull --rebase; pullallbranches.sh ; git push; git branch -a; git remote prune origin; git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -D; git branch -a