Skip to content

Instantly share code, notes, and snippets.

@nelsonprsousa
Created May 3, 2021 15:34
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 nelsonprsousa/5ca4d357ed31e838a21c49cfaddf0f8a to your computer and use it in GitHub Desktop.
Save nelsonprsousa/5ca4d357ed31e838a21c49cfaddf0f8a to your computer and use it in GitHub Desktop.
Delete all local branches but main

git for-each-ref --format '%(refname:short)' refs/heads | grep -v main | xargs git branch -D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment