You can create an alias function like this:
removeLocals = "!f() { git branch | grep -v "main" | xargs git branch -D; }; f"
used: git removeLocals
git removeLocals
or if you want to account for master vs main
removeLocals = "!f() { git branch | grep -v /"$1/" | xargs git branch -D; }; f"
used: git removeLocals main
git removeLocals main
I recommend not doing the second one as you may accidentally remove your local version of main/master due to a typo
You could also just make two aliases removeLocalsMain and removeLocalsMaster
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You can create an alias function like this:
used:
git removeLocals
or if you want to account for master vs main
used:
git removeLocals main
I recommend not doing the second one as you may accidentally remove your local version of main/master due to a typo
You could also just make two aliases removeLocalsMain and removeLocalsMaster