diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2024-04-11 11:05:22 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2024-10-07 11:02:09 +0200 |
commit | 802fa566c76a4ab2a66765c25db8fa9968e3e2c0 (patch) | |
tree | 3325564b56ae20a08548b841f7ae15a61240b102 /git-which-tag.sh | |
parent | 02a8a8f74ff759bac641f38df5ad26307c7ba87d (diff) | |
download | gosc-802fa566c76a4ab2a66765c25db8fa9968e3e2c0.tar.gz |
feat(git-which-tag): list tags containing commits identified by grep string
Diffstat (limited to 'git-which-tag.sh')
-rwxr-xr-x | git-which-tag.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/git-which-tag.sh b/git-which-tag.sh new file mode 100755 index 0000000..b2665f5 --- /dev/null +++ b/git-which-tag.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu + +[ "$#" -lt 1 ] && exit 1 + +git log --color=never --all --pretty='%h' --grep="${1}" | while read -r ID ; do + tags="$(git tag --no-column -l 'v*' --sort='version:refname' --contains "$ID" \ + | head -n 5)" + if [ -n "$tags" ] ; then + printf "%s: %s\n" "$ID" "$tags" + fi +done |