Shell/Bash: delete all local branches git Example

By

Shell/Bash Example: This is the "delete all local branches git" Example. compiled from many sources on the internet by SimpleTutorials.org

delete all local branches git

$ git branch | grep -v "master" | xargs git branch -D 

git delete all branches except master

git branch | grep -v "master" | xargs git branch -D

how to delete all branches in git except master

$ git branch | grep -v '^*' | xargs git branch -D

git branch delete all local branches

// hard delete

git branch -D $(git branch)

git delete all local branches

git for-each-ref --format '%(refname:short)' refs/heads | grep -v master | xargs git branch -D



* Summary: This "delete all local branches git" Shell/Bash Example is compiled from the internet. If you have any questions, please leave a comment. Thank you!

Others