Reputation: 575
I'm using the git-flow-avh
version of the tool. We'd like name the release branch differently that the tag. We'd like the branch name to match our release cycle (sprint-123
), but the tag should be production_<YYYYMMDDHHMMSS>
with a timestamp.
I see a command line options to suppress tagging and to customize the message, but nothing to override the tag name.
Can I do this?
Upvotes: 0
Views: 1600
Reputation: 14498
You can with a work around.
By default you can't change the tag, but if you finish a release without a tag you could use the hook pre-flow-release-finish
and tag in that script.
What you need to do is tag the branch from which the release is created, usually develop
and then tag.
Example script, the script actually gets the branch from which the release is started (BASE_BRANCH)
#!/bin/sh
#
# Runs before git flow release finish
#
# Positional arguments:
# $1 The version (including the version prefix)
# $2 The origin remote
# $3 The full branch name (including the release prefix)
#
# The following variables are available as they are exported by git-flow:
#
# MASTER_BRANCH - The branch defined as Master
# DEVELOP_BRANCH - The branch defined as Develop
#
VERSION=$1
ORIGIN=$2
BRANCH=$3
# Implement your script here.
BASE_BRANCH=$(git config --local --get "gitflow.branch.$3.base")
BASE_BRANCH=${BASE_BRANCH:-$DEVELOP_BRANCH}
TIMESTAMP=$(date +%Y%m%d%H%M%S)
git checkout $BASE_BRANCH
git tag "production_"$T
git checkout $3
# To terminate the git-flow action, return a non-zero exit code.
exit 0
Upvotes: 1