Git Version tags for Gem changes
Say the gem is abcd
The git hook will be
File: .git/hooks/post-commit
#! /bin/bash
version=`git diff HEAD^..HEAD -- "$(git rev-parse --show-toplevel)"/lib/abcd/version.rb | grep '^\+.*VERSION =' | sed -E '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
Inspired from https://coderwall.com/p/mk18zq :)
Written by Dinesh Vasudevan
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#