GIT - Delete all local branches that have been merged
Just saving it for future reference.
This deletes all local branches that have been merged already:
git branch --merged | grep -v \* | xargs git branch -d
--merged : gets only merged branches
grep -v * : kicks master branch out of the list
Written by Cristina Sturm
Related protips
1 Response
It'd probably be better to use -d instead of -D to ensure that only the merged branches are caught. It shouldn't make a difference either way, but -d adds that little bit of insurance to this operation.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#