Created
July 8, 2019 15:43
-
-
Save adaedra/3d915f2fd8685b2518671a877f28e9dd to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
if [ "${1}" = '-f' ]; then | |
cmd='git branch -D' | |
else | |
cmd='echo Will delete' | |
fi | |
LANG=en_US.UTF-8 \ | |
git branch --list --format '%(upstream:track,nobracket):%(refname:lstrip=2)' | \ | |
grep -E '^gone:' | \ | |
cut -d: -f 2 | \ | |
xargs -r -n 1 $cmd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment