aboutsummaryrefslogtreecommitdiff
path: root/git/git-move-tag.sh
blob: 05e82beff20c60c8c20782317c68402d9ebc23bb (plain)
1
2
3
4
5
6
7
8
9
10
11
#!/bin/sh
# git-move-tag <tag-name> <target>

tagName=$1
# Support passing branch/tag names (not just full commit hashes)
newTarget=$(git rev-parse $2^{commit})

git cat-file -p refs/tags/$tagName | 
sed "1 s/^object .*$/object $newTarget/g" | 
git hash-object -w --stdin -t tag | 
xargs -I {} git update-ref refs/tags/$tagName {}