Skip to content

Instantly share code, notes, and snippets.

@joseboretto
Last active December 20, 2022 13:51
Show Gist options
  • Save joseboretto/530fd575ba9b4cb29a48fc059da55e97 to your computer and use it in GitHub Desktop.
Save joseboretto/530fd575ba9b4cb29a48fc059da55e97 to your computer and use it in GitHub Desktop.
Git delete all local branches except "develop and master" from many directories/repo recursively
for d in ./*/ ; do (cd "$d" && git branch | grep -v "develop" | grep -v "master" | grep -v "release" | xargs git branch -D); done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment