Reputation: 3866
How can I put a tag on same references of another tag? For example I would like to put tag "Stable_Build" on a tag of a certain release "1.0.0.1".
Is there a better\faster way to do it except to:
git checkout 1.0.0.1
git tag -a Stable_Build
Upvotes: 15
Views: 8486
Reputation: 5515
go with git tag <new_tag> <old_tag>
(see docs)
$ git tag stable 1.0.0
$ git tag --list
1.0.0
stable
By the way: it would not refer to tag 1.0.0 but to same commit as tag 1.0.0.
Upvotes: 6
Reputation: 1324258
git tag new_tag old_tag
is problematic if the old tag is annotated, as torek commented.
This was illustrated on the Git mailing list by Robert Dailey.
And this is why Git 2.22 (Q2 2019) will warn you, giving an advice suggesting it might be a mistake when creating an annotated or signed tag that points at another tag.
See commit eea9c1e, commit 01dc801 (04 Apr 2019) by Denton Liu (Denton-L
).
Helped-by: Jeff King (peff
), and Ævar Arnfjörð Bjarmason (avar
).
(Merged by Junio C Hamano -- gitster
-- in commit a198562, 08 May 2019)
tag: advise on nested tags
Robert Dailey reported confusion on the mailing list about a nested tag which was most likely created by mistake.
Jeff King noted that this isn't a very common case and creating a tag-to-a-tag can be a user-error.Suggest that it may be a mistake with an advice message when creating such a tag.
Those who do want to create a tag that point at another tag regularly can turn it off with the usual advice mechanism.
You will now see, when tagging a tag (nested tagging):
hint: You have created a nested tag. The object referred to by your new is
hint: already a tag. If you meant to tag the object that it points to, use:
hint: |
hint: git tag -f nested annotated-v4.0^{}
So, if you already did:
git tag stable 1.0.0
You can fix it with:
git tag -f stable 1.0.0^{}
There might be later a "git tag --allow-nested-tag -f stable 1.0.0
" (if you actually wanted to tag the tag 1.0.0
by another annotated tag), but this is not implemented yet.
Upvotes: 9