Skip to content

Instantly share code, notes, and snippets.

@ifirmawan
Created January 9, 2022 03:27
Show Gist options
  • Save ifirmawan/86bd98c81c9784e550b4167d6a54feee to your computer and use it in GitHub Desktop.
Save ifirmawan/86bd98c81c9784e550b4167d6a54feee to your computer and use it in GitHub Desktop.
Remove all unused branch except current, main or master
git for-each-ref --format '%(refname:short)' refs/heads | grep -v "master\|main" | xargs git branch -D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment