Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Delete all local (and already merged/deleted) branches not on remote.
- git fetch -p && git branch -vv | grep ': gone]' | awk '{print $1}' | xargs git branch -D
- # Prune any branches that no longer exist on remote from our "remotes" list.
- git fetch -p
- # Show sha1 and commit subject line for each head, along with relationship to upstream branch (if any).
- # Print the name of the upstream branch, as well.
- git branch -vv
- # Filter and only show branches that have been removed on the remote.
- grep ': gone]'
- # Print first column only.
- awk '{print $1}'
- # build and execute command lines from standard input
- xargs
- # Delete local branch that has same name as one of the branches we isolated in previous steps.
- git branch -D
Add Comment
Please, Sign In to add comment