标记在 GIT 中的工作原理

How tagging works in GIT

我对 GIT 中的标记有疑问。

让我们想象一下,我正在处理一个存储库,其中我在 master 分支上合并了一系列更改,并且我用版本 2.1.0.[=16= 标记了主分支]

如果我现在进行其他更改并将它们也合并到 master 分支,则 2.1.0 标记将捕获那些新的合并更改,否则我将不得不创建另一个版本 2.1.1(例如)?

非常感谢!! :)

标记是指向提交的指针

来自documentation

Git supports two types of tags: lightweight and annotated.

A lightweight tag is very much like a branch that doesn’t change — it’s just a pointer to a specific commit.

Annotated tags, however, are stored as full objects in the Git database. >They’re checksummed; contain the tagger name, email, and date; have a tagging message; and can be signed and verified with GNU Privacy Guard (GPG). It’s generally recommended that you create annotated tags so you can have all this information; but if you want a temporary tag or for some reason don’t want to keep the other information, lightweight tags are available too.

因此,如果您更改分支,您的标签不会发生任何变化