Skip to content

Instantly share code, notes, and snippets.

@LoicMahieu
Created September 11, 2015 13:55
Show Gist options
  • Save LoicMahieu/db7e5f4916714d97fb67 to your computer and use it in GitHub Desktop.
Save LoicMahieu/db7e5f4916714d97fb67 to your computer and use it in GitHub Desktop.
# FIRST_COMMIT=$(git rev-list --parents HEAD | egrep "^[a-f0-9]{40}$")
FIRST_COMMIT="11151aa8ea4da0f9a71e88a5db3c9b4444e555df"
RESOLVE_TAG="
var message = process.argv[1];
var regex = /^v([0-9]+)\.([0-9]+)\.([0-9]+) (full|base)/;
var match = message.match(regex);
if (!match) {
process.exit(0);
}
var version = 'v' + match[1] + '.' + match[2] + '.' + match[3];
if (match[4] == 'base') {
version = 'base-' + version;
}
console.log(version);
"
for COMMIT in $(git log --format=format:%H $FIRST_COMMIT..master); do
MESSAGE=$(git log --format=%B -n 1 ${COMMIT})
TAG=$(node -e "$RESOLVE_TAG" "$MESSAGE")
if [ "$TAG" != "" ]; then
# git push --delete origin $TAG
# git tag -d $TAG
git tag $TAG $COMMIT
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment