Created
July 28, 2020 09:44
-
-
Save regisdiogo/d08720267f3d474bd9d26761acd0d04b to your computer and use it in GitHub Desktop.
Delete local branches that were merged on remote - Keeping it a cleaner list of branches locally
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
# first update all local branches | |
# then get all the merged branches | |
# from those, exclude our trunk from the list | |
# pass those branches to `branch -d` to delete them | |
git fetch -u -p && git branch --merged | grep -v "trunk" | xargs git branch -d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment