File: git-delete-tag

package info (click to toggle)
git-extras 7.4.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 2,120 kB
  • sloc: sh: 4,312; python: 994; makefile: 146
file content (28 lines) | stat: -rwxr-xr-x 621 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env bash

# Assert there is at least one tag provided
test -z "$1" && echo "tag required." 1>&2 && exit 1

# Detect the default remote exists or not
default_remote=$(git config git-extras.default-remote)

if [[ -n "$default_remote" ]]; then
    origin="$default_remote"
else
    origin=origin
fi

# Concatenate all the tag references
local_tags=""
origin_refs=""
for tagname in "$@"
do
  local_tags=$local_tags" $tagname"
  origin_refs=$origin_refs" :refs/tags/$tagname"
done

# Delete all the tags
# shellcheck disable=SC2086
git tag -d $local_tags
# shellcheck disable=SC2086
git push "$origin" $origin_refs