Skip to content

Instantly share code, notes, and snippets.

@braz
Created September 14, 2021 10:04
Show Gist options
  • Save braz/ef61902d12e75d8d5043e69020d2eb45 to your computer and use it in GitHub Desktop.
Save braz/ef61902d12e75d8d5043e69020d2eb45 to your computer and use it in GitHub Desktop.
Cleanup local branches in Git no longer present remotely
$ ~/.gitconfig
[alias]
janitor = !"git remote prune origin ; git branch -vv | grep ' gone]' | awk '{print $1}' | xargs git branch -D"
Run using
$ git janitor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment