← 返回命令列表

Linux command

git-tag 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

List tags

git tag

Create lightweight tag

git tag [name]

Create annotated tag

git tag -a [name] -m "[message]"

Create signed tag

git tag -s [name] -m "[message]"

Tag specific commit

git tag [name] [commit]

Delete tag

git tag -d [name]

Push tag to remote

git push origin [name]

List tags matching pattern

git tag -l "[v1.*]"

说明

git tag creates, lists, deletes, and verifies tag objects. Tags mark specific points in history as important, typically used for release versions. Lightweight tags are simple pointers to a commit, while annotated tags store extra metadata such as the tagger name, date, and a message. Signed tags add a GPG signature for verification.

参数

-a, --annotate
Create annotated tag.
-m, --message _msg_
Tag message.
-s, --sign
Create signed tag.
-d, --delete
Delete tag.
-f, --force
Force replace tag.
-l, --list _pattern_
List matching tags.
-n _num_
Show lines of annotation.
--contains _commit_
Tags containing commit.
--sort _key_
Sort tags.

FAQ

What is the git-tag command used for?

git tag creates, lists, deletes, and verifies tag objects. Tags mark specific points in history as important, typically used for release versions. Lightweight tags are simple pointers to a commit, while annotated tags store extra metadata such as the tagger name, date, and a message. Signed tags add a GPG signature for verification.

How do I run a basic git-tag example?

Run `git tag` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -a, --annotate do in git-tag?

Create annotated tag.