Skip to content

Instantly share code, notes, and snippets.

@wvanderdeijl
Last active April 7, 2021 05:51
Show Gist options
  • Save wvanderdeijl/86034bcaf16210b8b52569aa000f6eca to your computer and use it in GitHub Desktop.
Save wvanderdeijl/86034bcaf16210b8b52569aa000f6eca to your computer and use it in GitHub Desktop.
Clean up merged git branches

To get list of merged branches:

git branch --merged develop
git branch --merged master

To delete all merged branches while asking approval for each branch: (be careful not to delete important branches like develop, staging or master)

git branch --merged develop | xargs -n 1 -p git branch -d
git branch --merged master | xargs -n 1 -p git branch -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment