Last active
September 11, 2017 17:48
-
-
Save jesselcampbell/426749939e4ae8766864dd5b9ab183f5 to your computer and use it in GitHub Desktop.
Git clean: delete merged branches
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
# Source: https://stevenharman.net/git-clean-delete-already-merged-branches | |
# To delete local branches which have already been merged into master | |
$ git branch --merged master | grep -v "\* master" | xargs -n 1 git branch -d | |
# You can omit the master branch argument to remove local branches which have already been merged into the current HEAD | |
$ git branch --merged | grep -v "\*" | xargs -n 1 git branch -d | |
# To update the local list of remote branches | |
$ git remote update origin --prune |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment