While doing a release, I checked out the previously released tag and cherry-picked the new items (using git cherry-pick <commit-id>
) into it. Then, I created a new tag using git tag <tag-name>
.
Will this affect the old tag I cherry-picked the changes into?
In one word: no. Tags, once created, are not meant to move around like branch references do. You'd need to deliberately use
git tag --force v1.0 <some-other-commit>
to move the v1.0
tag to some other commit. Cherry-picking other commits (in other words, applying the changes introduced by those other commits) on top of a tagged commit won't affect the tag.
As an example, if v1.0
is a tag and your history looks as follows,
A -- B [master,v1.0]
\
C -- D [develop]
and then you run
git checkout v1.0
git checkout -b rc1.1
git cherry-pick C
git cherry-pick D
you'll end up with
A -- B [master,v1.0]
\ \
\ C' -- D' [HEAD,rc1.1]
\
C -- D [develop]
The v1.0
tag will stay in place, still pointing at commit B.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With