Skip to content

Instantly share code, notes, and snippets.

@netsprout
Created March 8, 2016 06:11
Show Gist options
  • Save netsprout/53512a15d5d545f6f8ad to your computer and use it in GitHub Desktop.
Save netsprout/53512a15d5d545f6f8ad to your computer and use it in GitHub Desktop.
Git Branch Cleanup Shell Aliases
## Git branch cleanup
# remove remote branches merged into my local development
alias gitcleanupremote='git branch --merged development | grep -v "\*" | grep -v "master*" | grep -v "developoment" | xargs -I {} git push origin :{}'
# rename for deletion local branches merged into my local development
alias gitcleanup='git branch --merged development | grep -v "\*" | grep -v "master*" | grep -v "developoment" | xargs -I {} git branch -m {} "DELETEME-{}"'
# Delete branches marked for delete
alias gitdestroy='git branch | grep DELETEME- | xargs -n 1 git branch -d'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment