#!/bin/sh # git-move-tag 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 {}