git-clean – Stepan Suvorov Blog https://stepansuvorov.com/blog Release 2.0 Wed, 08 Mar 2017 12:44:03 +0000 en-US hourly 1 https://wordpress.org/?v=6.3.1 git-clean: Remove all local branches https://stepansuvorov.com/blog/2017/03/git-clean-remove-all-local-branches/ https://stepansuvorov.com/blog/2017/03/git-clean-remove-all-local-branches/#comments Wed, 08 Mar 2017 12:44:03 +0000 http://stepansuvorov.com/blog/?p=3288 Continue reading ]]> Made a note about it 4 years ago, but it looks like the note is still pretty usefull. So one more time for en readers.

To remove all merged branches(except current -v ‘*’):

git branch --merged | grep -v '*' | xargs git branch -D

also I made such command for repo complete clean up:

alias git-clean="git branch  | grep -v '*' | grep -v 'master' | xargs git branch -D  && git reset --hard && git clean -d -x -f"
]]>
https://stepansuvorov.com/blog/2017/03/git-clean-remove-all-local-branches/feed/ 2