git_delete_branches

This script will delete all local and remote branches from the Git repository in the given directory ($PWD if not given).

The optional second parameter is the name of the branch to keep (defaults to the value of the init.defaultBranch Git configuration parameter or main if not set).

The branches will be irreversibly deleted—​be careful, you have been warned!

Usage

$ scripts/git/git_delete_branches.sh
$ scripts/git/git_delete_branches.sh /tmp/example
$ scripts/git/git_delete_branches.sh /tmp/example master

More Information