Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igorescobar/4730665 to your computer and use it in GitHub Desktop.
Save igorescobar/4730665 to your computer and use it in GitHub Desktop.
Show Which Branches are Merged (or not)
When working with feature branches, you can quickly create so many that clutter up the output of git branch --list. Every now and again you want to get rid of the branches that have made it into master. But you probably have a quick pause before you git branch -d <BRANCH>, but with the below commands you can confidently delete them without a second thought. (via Zach Holman)
If you want to see which local branches you have that are merged into the branch you are currently on, then all you need is:
git branch --merged
The reverse is also available. Show which branches haven't been merged into the currently selected branch with:
git branch --no-merged
Mash this up with a couple easy UNIX tools and you can quickly delete everything that has already been merged:
git branch --merged | xargs git branch -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment