4 ms·
DEFAULT_BRANCH=$(git remote show origin | sed -n '/HEAD branch/s/.*: //p') git branch --merged "origin/$DEFAULT_BRANCH" \ | grep -vE "^\s*(\*|$DEFAUL
by maerF0x0 8mo ago
DEFAULT_BRANCH=$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')
git branch --merged "origin/$DEFAULT_BRANCH" \
| grep -vE "^\s*(\*|$DEFAULT_BRANCH)" \
| xargs -r -n 1 git branch -d
This is the version I'd want in my $EMPLOYER's codebase that has a mix of default branches