Skip to content

Instantly share code, notes, and snippets.

@fajarmf
Created September 13, 2016 07:38
Show Gist options
  • Save fajarmf/426f2d1b442cea27d26cea5a6a3efa04 to your computer and use it in GitHub Desktop.
Save fajarmf/426f2d1b442cea27d26cea5a6a3efa04 to your computer and use it in GitHub Desktop.
Cleanup local branch that doesn't have remote upstream. Most of the time due to PR squash
git fetch --prune; diff --new-line-format="" --unchanged-line-format="" <(git branch | grep -v master | grep -v "*" | sort) <(git branch -r | awk '{print $1}' | awk '{sub("origin/", ""); print $0}' | sort) | xargs git branch -D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment