Skip to content

Instantly share code, notes, and snippets.

@timnew
Created August 8, 2017 06:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timnew/7fd20a03aec829385a0c36ad7da6d732 to your computer and use it in GitHub Desktop.
Save timnew/7fd20a03aec829385a0c36ad7da6d732 to your computer and use it in GitHub Desktop.
Git Clean Squashed
git-clean-squashed='git checkout -q master && git for-each-ref refs/heads/ "--format=%(refname:short)" | while read branch; do mergeBase=$(git merge-base master $branch) && [[ $(git cherry master $(git commit-tree $(git rev-parse $branch^{tree}) -p $mergeBase -m _)) == "-"* ]] && git branch -D $branch; done'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment