Skip to content

Instantly share code, notes, and snippets.

@adaedra
Created July 8, 2019 15:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adaedra/3d915f2fd8685b2518671a877f28e9dd to your computer and use it in GitHub Desktop.
Save adaedra/3d915f2fd8685b2518671a877f28e9dd to your computer and use it in GitHub Desktop.
#!/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