#!/bin/sh # # git-tag-update, Copyright © 2012 Matteo Cypriani # # This program is free software. It comes without any warranty, to # the extent permitted by applicable law. You can redistribute it # and/or modify it under the terms of the Do What The Fuck You Want # To Public License, Version 2, as published by Sam Hocevar. See # http://sam.zoy.org/wtfpl/COPYING for more details. # # This script allows one to update a Git tag message while keeping its # original date. The tag's author will be changed to whatever is the # current author (you can change it temporarily with git config if you # need to update commits with different authors). set -e #set -x if [ $# -ne 1 ] ; then echo "Usage: $0 " >&2 exit 1 fi commiter_date() { git tag -v "$TAG" 2>/dev/null | grep ^tagger | cut -f5- -d' ' } TAG="$1" GIT_COMMITTER_DATE="$(commiter_date)" export GIT_COMMITTER_DATE git tag -sf "$TAG" "$TAG" echo "Old tag commiter date: $GIT_COMMITTER_DATE" GIT_COMMITTER_DATE="$(commiter_date)" echo "New tag commiter date: $GIT_COMMITTER_DATE"