Setup and Config
Getting and Creating Projects
Basic Snapshotting
Branching and Merging
Sharing and Updating Projects
Inspection and Comparison
Patching
Debugging
External Systems
Server Admin
Guides
- gitattributes
- Command-line interface conventions
- Everyday Git
- Frequently Asked Questions (FAQ)
- Glossary
- Hooks
- gitignore
- gitmodules
- Revisions
- Submodules
- Tutorial
- Workflows
- All guides...
Administration
Plumbing Commands
-
2.52.0
2025-11-17
- 2.46.1 → 2.51.2 no changes
-
2.46.0
2024-07-29
- 2.45.1 → 2.45.4 no changes
-
2.45.0
2024-04-29
- 2.44.1 → 2.44.4 no changes
-
2.44.0
2024-02-23
- 2.42.1 → 2.43.7 no changes
-
2.42.0
2023-08-21
- 2.41.1 → 2.41.3 no changes
-
2.41.0
2023-06-01
- 2.39.1 → 2.40.4 no changes
-
2.39.0
2022-12-12
- 2.35.1 → 2.38.5 no changes
-
2.35.0
2022-01-24
- 2.31.1 → 2.34.8 no changes
-
2.31.0
2021-03-15
- 2.29.1 → 2.30.9 no changes
-
2.29.0
2020-10-19
- 2.27.1 → 2.28.1 no changes
-
2.27.0
2020-06-01
- 2.25.1 → 2.26.3 no changes
-
2.25.0
2020-01-13
- 2.23.1 → 2.24.4 no changes
-
2.23.0
2019-08-16
- 2.21.1 → 2.22.5 no changes
-
2.21.0
2019-02-24
- 2.19.3 → 2.20.5 no changes
-
2.19.2
2018-11-21
- 2.19.1 no changes
-
2.19.0
2018-09-10
- 2.18.1 → 2.18.5 no changes
-
2.18.0
2018-06-21
- 2.17.1 → 2.17.6 no changes
-
2.17.0
2018-04-02
- 2.15.4 → 2.16.6 no changes
-
2.14.6
2019-12-06
-
2.13.7
2018-05-22
-
2.12.5
2017-09-22
-
2.11.4
2017-09-22
-
2.10.5
2017-09-22
-
2.9.5
2017-07-30
- 2.8.6 no changes
-
2.7.6
2017-07-30
-
2.6.7
2017-05-05
- 2.5.6 no changes
-
2.4.12
2017-05-05
- 2.2.3 → 2.3.10 no changes
-
2.1.4
2014-12-17
-
2.0.5
2014-12-17
概述
git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] [-e] [(--trailer <token>[(=|:)<value>])…] <tagname> [<commit> | <object>] git tag -d <tagname>… git tag [-n[<num>]] -l [--contains <commit>] [--no-contains <commit>] [--points-at <object>] [--column[=<options>] | --no-column] [--create-reflog] [--sort=<key>] [--format=<format>] [--merged <commit>] [--no-merged <commit>] [<pattern>…] git tag -v [--format=<format>] <tagname>…
描述
在`refs/tags/中添加一个标签引用,除非给出-d/-l/-v`来删除、列出或验证标签。
除非给出`-f`,否则命名的标签必须还不存在。
如果传递了 -a、 -s 或 -u <key-id>`中的一个,该命令会创建一个 '标签' 对象,并要求提供一个标签信息。 除非给出-m <信息>或-F <文件>`,否则会启动一个编辑器,让用户输入标签信息。
If -m <msg> or -F <file> or --trailer <token>[=<value>] is given and -a, -s, and -u <key-id> are absent, -a is implied.
否则,就会创建一个直接指向给定对象的标签引用(即一个轻量级标签)。
当使用`-s`或`-u <键-id>时,将创建一个GnuPG签名标签对象。 当没有使用-u <键-id>时,当前用户的提交者身份会被用来寻找GnuPG密钥进行签名。 配置变量 `gpg.program 用于指定自定义 GnuPG 二进制文件。
标签对象(用`-a`、-s`或-u`创建)被称为 "注释 "标签;它们包含创建日期、标记者姓名和电子邮件、标记信息和可选的GnuPG签名。而 "轻量级 "标签只是一个对象(通常是一个提交对象)的名称。
注释性标签是用来发布的,而轻量级标签则是用于私人或临时对象的标签。由于这个原因,一些命名对象的git命令(如`git describe`)默认会忽略轻量级标签。
选项
- -a
- --annotate
-
制作一个无符号、有注释的标签对象
- -s
- --sign
-
制作一个GPG签名的标签,使用默认电子邮件地址的密钥。 标签GPG签名的默认行为由`tag.gpgSign`配置变量控制(如果存在),否则禁用。 参见 git-config[1]。
- --no-sign
-
覆盖`tag.gpgSign`配置变量,该变量被设置为强制每一个标签都被签名。
- -u <键 ID>
- --local-user=<键 ID>
-
制作一个GPG签名的标签,使用给定的密钥。
- -f
- --force
-
用给定的名称替换一个现有的标签(而不是失败)