Allow finishing release branches without creating a tag.
This is useful for small projects.
diff --git a/git-flow-hotfix b/git-flow-hotfix
index 07bee23..436760c 100644
--- a/git-flow-hotfix
+++ b/git-flow-hotfix
@@ -195,6 +195,7 @@
DEFINE_string message "" "use the given tag message" m
DEFINE_boolean push false "push to $ORIGIN after performing finish" p
DEFINE_boolean keep false "keep branch after performing finish" k
+ DEFINE_boolean notag false "don't tag this release" n
parse_args "$@"
require_version_arg
@@ -230,17 +231,19 @@
# TODO: What do we do now?
fi
- # try to tag the release
- # in case a previous attempt to finish this release branch has failed,
- # but the tag was set successful, we skip it now
- local tagname=$VERSION_PREFIX$VERSION
- if ! git_tag_exists "$tagname"; then
- local opts="-a"
- flag sign && opts="$opts -s"
- [ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
- [ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
- git tag $opts "$VERSION_PREFIX$VERSION" || \
- die "Tagging failed. Please run finish again to retry."
+ if noflag notag; then
+ # try to tag the release
+ # in case a previous attempt to finish this release branch has failed,
+ # but the tag was set successful, we skip it now
+ local tagname=$VERSION_PREFIX$VERSION
+ if ! git_tag_exists "$tagname"; then
+ local opts="-a"
+ flag sign && opts="$opts -s"
+ [ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
+ [ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
+ git tag $opts "$VERSION_PREFIX$VERSION" || \
+ die "Tagging failed. Please run finish again to retry."
+ fi
fi
# try to merge into develop
@@ -267,15 +270,19 @@
die "Could not push to $DEVELOP_BRANCH from $ORIGIN."
git push "$ORIGIN" "$MASTER_BRANCH" || \
die "Could not push to $MASTER_BRANCH from $ORIGIN."
- git push --tags "$ORIGIN" || \
- die "Could not push tags to $ORIGIN."
+ if noflag notag; then
+ git push --tags "$ORIGIN" || \
+ die "Could not push tags to $ORIGIN."
+ fi
fi
echo
echo "Summary of actions:"
echo "- Latest objects have been fetched from '$ORIGIN'"
echo "- Hotfix branch has been merged into '$MASTER_BRANCH'"
- echo "- The hotfix was tagged '$VERSION_PREFIX$VERSION'"
+ if noflag notag; then
+ echo "- The hotfix was tagged '$VERSION_PREFIX$VERSION'"
+ fi
echo "- Hotfix branch has been back-merged into '$DEVELOP_BRANCH'"
if flag keep; then
echo "- Hotfix branch '$BRANCH' is still available"
diff --git a/git-flow-release b/git-flow-release
index 2b3684f..e24c55e 100644
--- a/git-flow-release
+++ b/git-flow-release
@@ -192,6 +192,7 @@
DEFINE_string message "" "use the given tag message" m
DEFINE_boolean push false "push to $ORIGIN after performing finish" p
DEFINE_boolean keep false "keep branch after performing finish" k
+ DEFINE_boolean notag false "don't tag this release" n
parse_args "$@"
require_version_arg
@@ -228,17 +229,19 @@
# TODO: What do we do now?
fi
- # try to tag the release
- # in case a previous attempt to finish this release branch has failed,
- # but the tag was set successful, we skip it now
- local tagname=$VERSION_PREFIX$VERSION
- if ! git_tag_exists "$tagname"; then
- local opts="-a"
- flag sign && opts="$opts -s"
- [ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
- [ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
- git tag $opts "$tagname" || \
- die "Tagging failed. Please run finish again to retry."
+ if noflag notag; then
+ # try to tag the release
+ # in case a previous attempt to finish this release branch has failed,
+ # but the tag was set successful, we skip it now
+ local tagname=$VERSION_PREFIX$VERSION
+ if ! git_tag_exists "$tagname"; then
+ local opts="-a"
+ flag sign && opts="$opts -s"
+ [ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
+ [ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
+ git tag $opts "$tagname" || \
+ die "Tagging failed. Please run finish again to retry."
+ fi
fi
# try to merge into develop
@@ -268,8 +271,10 @@
die "Could not push to $DEVELOP_BRANCH from $ORIGIN."
git push "$ORIGIN" "$MASTER_BRANCH" || \
die "Could not push to $MASTER_BRANCH from $ORIGIN."
- git push --tags "$ORIGIN" || \
- die "Could not push tags to $ORIGIN."
+ if noflag notag; then
+ git push --tags "$ORIGIN" || \
+ die "Could not push tags to $ORIGIN."
+ fi
git push "$ORIGIN" :"$BRANCH" || \
die "Could not delete the remote $BRANCH in $ORIGIN."
fi
@@ -278,7 +283,9 @@
echo "Summary of actions:"
echo "- Latest objects have been fetched from '$ORIGIN'"
echo "- Release branch has been merged into '$MASTER_BRANCH'"
- echo "- The release was tagged '$tagname'"
+ if noflag notag; then
+ echo "- The release was tagged '$tagname'"
+ fi
echo "- Release branch has been back-merged into '$DEVELOP_BRANCH'"
if flag keep; then
echo "- Release branch '$BRANCH' is still available"