The bad news is that the name of the annotated tag object is embedded inside the annotated tag object. Therefore, if you want to be completely thorough, you will need to replace those tagged objects:
If they are tagged, you will need to restore them with new signatures.
Otherwise, it is possible to copy tag objects into new tag objects, with changes to the systematic name that you want to make. For example, the filter-branch command does this. (This is a bit ugly, since you need to use some low-level plumbing commands, there is no simple convenient method, but see below.)
The good news is that there is no absolute requirement that you use the โcorrectโ annotated tag along with the light tag. That is, the annotated tag is actually a pair of objects: a light tag (with some name, which is simply an entry in the refs/tags/ namespace), along with an annotated tag object (in the repository itself), which usually has the same name in the tag field. But you can create a new light tag that points to an existing annotated tag object, and then optionally delete the original light tag:
$ git cat-file -p v2.5.0 | sed 's/@/ /' object a17c56c056d5fea0843b429132904c429a900229 type commit tag v2.5.0 tagger Junio C Hamano <gitster pobox.com> 1438025401 -0700 Git 2.5 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJVtoa5AAoJELC16IaWr+bLRtQP/0RYjVe9fLubiN5vLaAJ98B5 K3apw8bScJ4bZQJiOGMZg7AJ8pSB9XchqopjNlO2v8XVrZEkFPQ7ln3ELjOITusO 0MIZz6Y4sS0yqMklNPWx/OIzvSyKOs8quUA/J87Ha+pnMYlobDgWJxDnZ3hVO6q2 0lVMRUvwM9qsBiPsVKyAba5qPDBn9uTjgR/hivA3Ha97foq/qMM6rjERp5hX8KTE JacLMlx7ZSAJiNKmz1mVk+xyDVGDh9nojiz93jRYohAM8gsbyyRayPGKlKsMrajC s0bLxilV8zupNrMOs54ND71VqNo992ewiCrB3FBpTah2rPE0MKsxCY72pFiZp/hn w1I3seQbd880d2TXfczVVphG3xN3xbfnC+aEqobgPuFIgGxHqeWqUpDQnWa0XhtK i5phhENEjbMdCDGf7ylRRvCTL5O2Mz1XnNfZBP0uqIX6PyzaCwcZM1DUP0xY8Nvz xo0BplMvK4sAr+fCW0HHHlDO6Ky3jjRyPUEyVEbwF50lZ3Sgzkkf32I06yeZgQW9 Ge6+qGopw7JVQM95UDMBysbQSNuTmwnclwn0DBfc85vQwZw5OwnRk0RsQxcnqNr2 B4Nyubl8Pge4H0T0pahpAdr0AU7JHv4i4yYZh1Dr4d+hzzXAK+ospCxkcJVX7Qz5 BP8pbLPj3ubLAenxg71I =xfTv -----END PGP SIGNATURE----- $ git rev-parse v2.5.0 8d1720157c660d9e0f96d2c5178db3bc8c950436 $ git tag silly v2.5.0 $ git rev-parse silly 8d1720157c660d9e0f96d2c5178db3bc8c950436 $ git tag -d v2.5.0 Deleted tag 'v2.5.0' (was 8d17201) $ git for-each-ref refs/tags/silly 8d1720157c660d9e0f96d2c5178db3bc8c950436 tag refs/tags/silly
(I restored the old tag and deleted the โstupidโ version after that, so it is not very thoroughly tested, but at least it did not explode.)
To automate either tag copying or tag re-creation (with or without signatures), simply use git for-each-ref to find all the old tags and use the resulting names to create new tags. Use git cat-file -p to print an existing tag for modification to create a new tag or just make a new tag that points to an existing tag object. After printing the tag (into a pipe or file) you can edit it with sed or some another programmable editor and pass the result of git tag -F as input or git mktag to create a tag object by submitting the received SHA-1 to git tag to make the corresponding light tag.
(Note: if you got a portion of a bash script entry to do all this, and you just need help to finish it or fix some problems with it, post the script - this far.)
source share