2012 / 04 / 26 - San Luis Obispo, CA
Want to clean up all those merged feature branches in git, but don’t feel like installing a program like git-sweep to do something that can be done in a one line bash command?
git branch --merged master | # list branches merged into master grep -v master | # exclude master xargs git branch -d # tell git to delete them
git remote prune origin # prune deleted tracking branches git branch -r --merged origin/master | # list branches merged into master grep -v master | # exclude master sed -n "s| origin/|:|p" | # use remote branch delete syntax # and only include origin branches xargs git push origin # delete them on the remote