Skip to content

Instantly share code, notes, and snippets.

@regisdiogo
Created July 28, 2020 09:44
Show Gist options
  • Save regisdiogo/d08720267f3d474bd9d26761acd0d04b to your computer and use it in GitHub Desktop.
Save regisdiogo/d08720267f3d474bd9d26761acd0d04b to your computer and use it in GitHub Desktop.
Delete local branches that were merged on remote - Keeping it a cleaner list of branches locally
# first update all local branches
# then get all the merged branches
# from those, exclude our trunk from the list
# pass those branches to `branch -d` to delete them
git fetch -u -p && git branch --merged | grep -v "trunk" | xargs git branch -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment