-
-
Save malclocke/943565 to your computer and use it in GitHub Desktop.
delete all remote branches that have already been merged into master
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 -r --merged | | |
| awk -F'/' '/^ *origin/{if(!match($0, /(>|master)/)){print $2}}' | | |
| xargs git push origin --delete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@talsafran Yep, -r is not an option on MacOS xargs (see:
man xargs)-r is a GNU extension
You can install GNU xargs through Homebrew and the GNU findutils package.
brew install findutilsThis will give you GNU
xargsasgxargs, and you can use the -r optionThe same goes for other basic commands found in the findutils package such as
gfindorglocateorgupdatedb, which have different BSD counterparts on OS X.After installing findutils, the command on MacOS will be: