Created
August 17, 2016 01:05
-
-
Save bennycwong/5c9f6adfa9037f0940a0cc7c1a0359be to your computer and use it in GitHub Desktop.
TIL: Clean up all branches except master (or another other rule you want)
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
| git branch | grep -v master | xargs -n 1 git branch -D | |
| git brach list branches | |
| grep -v is a filter | |
| xargs -n 1 pass in the arguments | |
| git branch -D is the command. | |
| This takes advantage of the pipe operator in *nix | |
| Other versions | |
| git branch --merged -> good for cleanup. | |
| git branch --no-merged | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment