Created
August 21, 2018 16:58
-
-
Save robvolk/cc40fc988e6ecd9250086ff2c8e906ef to your computer and use it in GitHub Desktop.
Cleanup git branches
This file contains hidden or 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
gitc() { | |
git fetch --prune | |
for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; | |
do | |
git branch -D $branch | |
done; | |
git branch --merged master | grep -v '^*' | grep -v '^ master$' | xargs git branch -d | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment