From 580e240c9e737fa6d8c363818ae73e4e22ba4e26 Mon Sep 17 00:00:00 2001 From: Matteo Cypriani Date: Sat, 3 Nov 2012 19:31:53 +0100 Subject: [PATCH] [git] Add git-tag-update --- git/README | 16 ++++++++++++++++ git/git-tag-update | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100755 git/git-tag-update diff --git a/git/README b/git/README index ddaa7d2..f833128 100644 --- a/git/README +++ b/git/README @@ -71,3 +71,19 @@ script in a directory in the PATH (for instance /usr/local/bin) and add an alias: git config --global alias.merge-ff-only "\!sh -c 'git-merge-ff-only'" + + +# git-tag-update # + +git-tag-update allows one to update a tag message while automatically +keeping its original date. It takes the name of the tag to update as an +argument. + +Beware that 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. + +To activate the git tag-update command, put the git-tag-update script in +a directory in the PATH (for instance /usr/local/bin) and add an alias: + + git config --global alias.tag-update "\!sh -c 'git-tag-update'" diff --git a/git/git-tag-update b/git/git-tag-update new file mode 100755 index 0000000..838b16a --- /dev/null +++ b/git/git-tag-update @@ -0,0 +1,32 @@ +#!/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 " + exit 1 +fi + +TAG=$1 + +GIT_COMMITTER_DATE="$(git tag -v $TAG 2>/dev/null|grep ^tagger | cut -f5- -d' ')" +export GIT_COMMITTER_DATE +git tag -sf $TAG $TAG + +echo "Old tag commiter date: $GIT_COMMITTER_DATE" +GIT_COMMITTER_DATE="$(git tag -v $TAG 2>/dev/null|grep ^tagger | cut -f5- -d' ')" +echo "New tag commiter date: $GIT_COMMITTER_DATE"