[git] Add git-tag-update
This commit is contained in:
parent
0abbb0bdfb
commit
580e240c9e
16
git/README
16
git/README
|
@ -71,3 +71,19 @@ script in a directory in the PATH (for instance /usr/local/bin) and
|
||||||
add an alias:
|
add an alias:
|
||||||
|
|
||||||
git config --global alias.merge-ff-only "\!sh -c 'git-merge-ff-only'"
|
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'"
|
||||||
|
|
|
@ -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 <tag-name>"
|
||||||
|
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"
|
Loading…
Reference in New Issue