The way to delete all the local branches except the one you want -
git branch | grep -v "branch_to_skip_deletion" | xargs git branch -D
Replace "branchtoskip_deletion" with the branch name you don't want to delete and this command will remove all the local branches except the mentioned one.