Created
April 29, 2020 04:39
-
-
Save cjonstrup/6f62105ab8b7ba732ba2f9cf82392574 to your computer and use it in GitHub Desktop.
Delete local branches that are merged
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
#!/bin/bash | |
CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD` | |
git checkout master && git pull --prune --all && git branch --merged | grep -vE "^\*|master" | xargs -r git branch -d | |
git checkout $CURRENT_BRANCH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment