Skip to content

Instantly share code, notes, and snippets.

@fdaciuk
Last active November 15, 2020 14:42
Show Gist options
  • Save fdaciuk/cda63330ab4961d6f2131a16f5e91f52 to your computer and use it in GitHub Desktop.
Save fdaciuk/cda63330ab4961d6f2131a16f5e91f52 to your computer and use it in GitHub Desktop.
Remove unused git branches

Remove unused git branchs

Update 'main|dev' with branches you want to mantain. All others will be removed.

for i in $(git branch | grep -v -E -w '(main|dev)$'); do
git branch -D "$i"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment