Created
October 21, 2013 13:58
-
-
Save rud/7084313 to your computer and use it in GitHub Desktop.
Revisions
-
rud created this gist
Oct 21, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ #!/bin/sh # Simple script for pruning local branches already merged, # and remove remote tracking branches that have been deleted # Default to "origin" if no remote is passed remote=${1-origin} # Branches to keep, regardless of their current merge state permanent_branches="develop|master|production" # Remove local already merged branches git branch --merged | grep -v -E "(\*|$permanent_branches)" | xargs -n 1 git branch -d # Retry with whatever 'git remote' outputs git remote prune $remote || git remote prune `git remote`