Created
December 14, 2017 10:19
-
-
Save marekpiechut/a1d975a840cc7ec184d132f7dc0468a6 to your computer and use it in GitHub Desktop.
GIT branches cleanup procedure
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
#Wipe all branches already merged on origin | |
git remote prune origin | |
#Remove all branches already merged to master | |
git branch --merged master | grep -v 'master' | xargs git branch -d | |
#Now let's check what's left | |
git branch | |
#Remove all other branches except master, leave-me and im-also-important | |
!!!WARNING: WILL DELETE UNMERGED BRANCHES, DOUBLE CHECK!!! | |
git branch | grep -Ev "master|leave-me|im-also-important" | xargs git branch -D |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment