3 #==============================================================================
5 # File ID: bb8f9564-dfd3-11e2-b044-0800274013ad
7 # Delete the specified Git branches or tags locally and from all remotes
9 # Author: Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 2 or later.
11 #==============================================================================
20 while test -n "$1"; do
22 -h|
--help) opt_help
=1; shift ;;
23 -n|
--dry-run) opt_dry_run
=1; shift ;;
24 -q|
--quiet) opt_quiet
=$
(($opt_quiet + 1)); shift ;;
25 -v|
--verbose) opt_verbose
=$
(($opt_verbose + 1)); shift ;;
26 --version) echo $progname $VERSION; exit 0 ;;
29 if printf '%s\n' "$1" |
grep -q ^
-; then
30 echo "$progname: $1: Unknown option" >&2
38 opt_verbose
=$
(($opt_verbose - $opt_quiet))
40 if test "$opt_help" = "1"; then
41 test $opt_verbose -gt 0 && { echo; echo $progname $VERSION; }
44 Delete the specified Git branches or tags locally and from all remotes
46 Usage: $progname [options] ref [...]
53 Don't delete anything, only print out what would be done.
55 Be more quiet. Can be repeated to increase silence.
57 Increase level of verbosity. Can be repeated.
59 Print version information.
65 if test "$opt_dry_run" = "1"; then
72 if test $opt_verbose -ge $1; then
74 echo "$progname: $*" >&2
79 remotes
="$(git remote)"
80 for b
in $branches; do
81 echo ==== $progname: branch
\"$b\" ====
82 git branch |
grep -q "^ $b\$" && {
83 msg
1 Executing
$sim git branch
-D $b
87 git branch
-a |
grep -q "^ remotes/$r/$b\$" && {
88 msg
1 Executing
$sim git push
$r :$b
94 # vim: set ts=8 sw=8 sts=8 noet fo+=w tw=79 fenc=UTF-8 :