Skip to content

Instantly share code, notes, and snippets.

@Hemric
Created June 17, 2021 12:35
Show Gist options
  • Save Hemric/95b44cc02d60fdf62e1b939cb1ae219e to your computer and use it in GitHub Desktop.
Save Hemric/95b44cc02d60fdf62e1b939cb1ae219e to your computer and use it in GitHub Desktop.

Delete local branches except dev, master

git branch | grep -v -e dev -e master | xargs git branch -D

Delete remote branches except dev, master

git branch -r | grep -v -e dev -e master | cut -c 10- | xargs git push --delete origin
@Hemric
Copy link
Author

Hemric commented Aug 16, 2022

git fetch --prune might be useful too

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