Created
March 14, 2014 17:48
-
-
Save asutherland/9552957 to your computer and use it in GitHub Desktop.
modified naive git cleanup script proposed by @millermedeiros
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
#!/bin/bash | |
MAYBEECHO= | |
if [ "$1" != 'gogogo' ]; then | |
MAYBEECHO=echo | |
echo "Pretending; pass 'gogogo' as an argument to actually do it." | |
echo | |
fi | |
git branch --merged origin/master | grep -v " master" | xargs -n 1 $MAYBEECHO git branch -d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
just updated my
.gitconfig
:so now I run
git dm
to delete all branches merged into master... it's a dangerous command since I'm not sure if there is an easy way to recover the branches (deletion doesn't show up on reflog), and if commit is merged it won't show up as a detached commit... but I don't think that it's a big deal, can probably just grep the log and find the SHA of the branch merge.