diff --git a/bin/git-release b/bin/git-release
index 194876e..d468311 100755
--- a/bin/git-release
+++ b/bin/git-release
@@ -51,6 +51,12 @@ if test $# -gt 0; then
semver=$2
shift
;;
+ --prefix)
+ test -z "$2" &&
+ exit_with_msg "prefix string required for --prefix option"
+ prefix="$2"
+ shift
+ ;;
--no-empty-commit) no_empty_commit=true;;
--) shift; hook_args="$hook_args $*"; break;;
*) test -z "$version" && version=$1 ;;
@@ -69,7 +75,7 @@ if test $# -gt 0; then
latest_tag=$(git describe --tags "$(git rev-list --tags --max-count=1)")
if [[ ! "$latest_tag" =~ \
- ^([^0-9]*)([1-9][0-9]+|[0-9])\.([1-9][0-9]+|[0-9])\.([1-9][0-9]+|[0-9])(.*) ]]; then
+ ^$prefix([^0-9]*)([1-9][0-9]+|[0-9])\.([1-9][0-9]+|[0-9])\.([1-9][0-9]+|[0-9])(.*) ]]; then
echo "the latest tag doesn't match semver format requirement" 1>&2
exit 1
fi
@@ -86,9 +92,9 @@ if test $# -gt 0; then
(( ++version ))
case "$semver" in
- major ) version="${BASH_REMATCH[1]}$version.0.0${BASH_REMATCH[5]}" ;;
- minor ) version="${BASH_REMATCH[1]}${BASH_REMATCH[2]}.$version.0${BASH_REMATCH[5]}" ;;
- patch ) version="${BASH_REMATCH[1]}${BASH_REMATCH[2]}.${BASH_REMATCH[3]}.$version${BASH_REMATCH[5]}" ;;
+ major ) version="$prefix${BASH_REMATCH[1]}$version.0.0${BASH_REMATCH[5]}" ;;
+ minor ) version="$prefix${BASH_REMATCH[1]}${BASH_REMATCH[2]}.$version.0${BASH_REMATCH[5]}" ;;
+ patch ) version="$prefix${BASH_REMATCH[1]}${BASH_REMATCH[2]}.${BASH_REMATCH[3]}.$version${BASH_REMATCH[5]}" ;;
esac
fi
diff --git a/etc/git-extras-completion.zsh b/etc/git-extras-completion.zsh
index 2cfa46e..c35574a 100644
--- a/etc/git-extras-completion.zsh
+++ b/etc/git-extras-completion.zsh
@@ -297,6 +297,7 @@ _git-release() {
'-s[Create a signed and annotated tag.]' \
'-u[Create a tag, annotated and signed with the given key.]' \
'--semver[If the latest tag in your repo matches the semver format requirement, you could increase part of it as the new release tag.]' \
+ '--prefix[Add a prefix string to semver to allow more complex tags.]' \
'--no-empty-commit[Avoid creating empty commit if nothing could be committed.]' \
'--[The arguments listed after "--" separator will be passed to pre/post-release hook.]'
}
diff --git a/man/git-release.1 b/man/git-release.1
index a070a20..bbaddea 100644
--- a/man/git-release.1
+++ b/man/git-release.1
@@ -1,13 +1,13 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "GIT\-RELEASE" "1" "April 2018" "" "Git Extras"
+.TH "GIT\-RELEASE" "1" "April 2022" "" "Git Extras"
.
.SH "NAME"
\fBgit\-release\fR \- Commit, tag and push changes to the repository
.
.SH "SYNOPSIS"
-\fBgit\-release\fR [ If the latest tag in your repo matches the semver format requirement, you could increase part of it as the new release tag
with this option. The name must be one of the SYNOPSIS
-git-release [<tagname> | --semver <name>] [-r <remote>] [-m <commit info>] [--no-empty-commit] [-c] [-s] [-u <key-id>] [[--] <hook arguments...>]git-release [<tagname> | --semver <name>] [-r <remote>] [-m <commit info>] [--no-empty-commit] [-c] [-s] [-u <key-id>] [--prefix <tag prefix>] [[--] <hook arguments...>]DESCRIPTION
@@ -94,12 +94,17 @@
major, minor, patch. For example, assumed the latest tag is 4.4.0, with
- git release --semver minor you will make a new release with tag 4.5.0.git release --semver minor you will make a new release with tag 4.5.0. Use --prefix if tag has a character before semver.
<tagname>
The name of the newly created tag. Also used in tag comment.
+--prefix <tag prefix>
+ + Use a prefix with a semver tag. git release --semver minor --prefix r would increment the latest tag r4.4.0 to r4.5.0. This prefix
+ can be any length, without spaces.
-r <remote>
The "remote" repository that is destination of a push operation: it is passed to git push.
@@ -155,8 +160,8 @@ populate changelog, and push to specific remote.Written by Tj Holowaychuk <tj@vision-media.ca> -Extended by David Hartmann <dh@tsl.io>
+Written by Tj Holowaychuk <tj@vision-media.ca> +Extended by David Hartmann <dh@tsl.io>