Reputation: 4124
Is is possible to automatically create Tags in SourceTree when there is a version change in the coding to be committed?
For instance, for iOS development, if CFBundleVersion
is changed to 12
or CFBundleShortVersionString
is changed to 1.1.2
, create a tag v1.1.2-b12
.
For Android, create a tag named v[versionName]-b[versionCode]
every time versionCode
or versionName
changed.
Upvotes: 2
Views: 883
Reputation: 5799
You can do this with a post-commit-hook, like described in this blogpost. Your .git/hooks/post-commit
would look similar to this one for an npm package.json file:
#! /bin/bash
version=`git diff HEAD^..HEAD -- "$(git rev-parse --show-toplevel)"/package.json | grep '^\+.*version' | sed -s 's/[^0-9\.]//g'`
if [ "$version" != "" ]; then
git tag -a "v$version" -m "`git log -1 --format=%s`"
echo "Created a new tag, v$version"
fi
Essentially, you grep the required version strings from your plist.info
in the first line and create a new tag in the if
-statement.
Upvotes: 4
Reputation: 1325017
Looking at client hooks, you could consider a post-commit hook, which would look at the last commit git log -p -l, and if it detects changes in CFBundleVersion
or CFBundleShortVersionString
, create the tag.
SourceTree won't influence that hook.
Upvotes: 1