主题
使用标签(Tag)
Git 标签(Tag)用于给特定的提交打上标记,常用来标记版本发布点,方便版本管理和回溯。
创建标签有两种主要方式:
- 轻量标签(lightweight):
bash
git tag v1.0
这只是给提交起个名字,没有附加说明。
- 注解标签(annotated):
bash
git tag -a v1.0 -m "版本1.0发布"
带有作者信息、日期和说明,推荐用于正式版本。
查看标签列表:
bash
git tag
查看某标签信息:
bash
git show v1.0
删除标签:
bash
git tag -d v1.0
推送标签到远程:
bash
git push origin v1.0
推送所有标签:
bash
git push origin --tags
合理使用标签,有助于版本追踪和发布管理。