DEV Community

Discussion on: Remove all your local git branches but keep main

Collapse
 
rubiin profile image
Rubin

most of my local branches have a prefix. So when i needed to cleanup all the local branches except the prod ,i have an alias set as git_branch_delete="git branch | grep $@ | xargs git branch -D". So i just do git_branch_delete flip and deletes all branches starting with flip prefix