Skip to content

Instantly share code, notes, and snippets.

@ErikSchierboom
Last active February 12, 2020 09:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ErikSchierboom/1d7823631c62fc600d48bcaff0a710d5 to your computer and use it in GitHub Desktop.
Save ErikSchierboom/1d7823631c62fc600d48bcaff0a710d5 to your computer and use it in GitHub Desktop.
.gitconfig alias to remove gone branches
[alias]
co = checkout
ap = !git commit --amend -a --no-edit && git push --force
gone = ! "git fetch -p && for branch in `git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | awk '$2 == \"[gone]\" {sub(\"refs/heads/\", \"\", $1); print $1}'`; do git branch -D $branch; done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment