Skip to content

Instantly share code, notes, and snippets.

@perrmadiafrrian
Created January 27, 2022 08:29
Show Gist options
  • Save perrmadiafrrian/0fbd08410e8ba831dc00de7efc9b042a to your computer and use it in GitHub Desktop.
Save perrmadiafrrian/0fbd08410e8ba831dc00de7efc9b042a to your computer and use it in GitHub Desktop.
Removing all local branch except `master` or `main`
#!/bin/sh
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