Last active
April 2, 2020 14:54
-
-
Save adrienjoly/351a9156c3a7e753b7dda44538953c1d to your computer and use it in GitHub Desktop.
List local git branches that were squashed and merged to master
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# List local branches that were squashed and merged to master | |
$ comm -1 -2 \ | |
<(git remote prune origin --dry-run | sed "s/^.*origin\///g") \ | |
<(git branch | sed "s/^..//") \ | |
| sed "/^$/d" | |
# List local branches that were squashed and merged to master | |
# ... then give you the opportunity to edit them before deleting them. | |
$ comm -1 -2 \ | |
<(git remote prune origin --dry-run | sed "s/^.*origin\///g") \ | |
<(git branch | sed "s/^..//") \ | |
| sed "/^$/d" \ | |
>/tmp/merged-branches \ | |
&& vi /tmp/merged-branches \ | |
&& xargs git branch -d </tmp/merged-branches |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment