I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
git branch | grep -v “master” | xargs git branch -D will delete branches that haven't been merged, which is potentially dangerous. I'd use -d instead, as you suggest in your fourth point, and if you end up with a couple of branches left over, you can delete them one at a time after you're sure you don't need them any more.
It will also keep branches that include the word master in it. If for some reason you have branches named like "not-master", then it is better to stay sharp! 😅
git branch | grep -v “master” | xargs git branch -D
will delete branches that haven't been merged, which is potentially dangerous. I'd use-d
instead, as you suggest in your fourth point, and if you end up with a couple of branches left over, you can delete them one at a time after you're sure you don't need them any more.It will also keep branches that include the word master in it. If for some reason you have branches named like "not-master", then it is better to stay sharp! 😅
Good point 👍🤠
git switch --detach origin/master
git branch --merged | xargs git branch -d
That would be another good choice. It has some of my additions.