Git 开源的版本控制系统-05-tags 标签管理

标签

  • 创建标签

git tag <标签名> [提交ID]

  • 显示标签

git tag

  • 显示标签详细信息

git show <标签名>

houbinbindeMacBook-Pro:git-demo houbinbin$ git branch
  git_demo_1.1
  git_demo_1.2
  git_demo_bug_001
* master
houbinbindeMacBook-Pro:git-demo houbinbin$ git tag v1.0
houbinbindeMacBook-Pro:git-demo houbinbin$ git tag
v1.0
houbinbindeMacBook-Pro:git-demo houbinbin$ git show v1.0
commit 4069a0cc54ee97993850419a09b62023ee3fa711
Author: “houbb” <“1060732496@qq.com”>
Date:   Mon Oct 10 22:48:07 2016 +0800

    fix the bug

diff --git a/README.md b/README.md
index 5664a33..98be30e 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,4 @@
 > Hello Git
 - git diff
-- git_demo_1.2
\ No newline at end of file
+- git_demo_1.2
+fix the bug
\ No newline at end of file

houbinbindeMacBook-Pro:git-demo houbinbin$ git log --pretty=oneline --abbrev-commit
4069a0c fix the bug
0d899d1 merge with --no-ff
8983fd1 change git_demo_1.2
d696904 add pom.xml
cd84e27 git diff
9f18a0c add readme
965cf5d first commit
houbinbindeMacBook-Pro:git-demo houbinbin$ git tag v0.9 0d899d1
houbinbindeMacBook-Pro:git-demo houbinbin$ git tag
v0.9
v1.0
houbinbindeMacBook-Pro:git-demo houbinbin$ git show tag v0.9
fatal: ambiguous argument 'tag': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
houbinbindeMacBook-Pro:git-demo houbinbin$ git show v0.9
commit 0d899d1e9fa22bc3d8092d4a709abc0174186f79
Merge: d696904 8983fd1
Author: “houbb” <“1060732496@qq.com”>
Date:   Mon Oct 10 22:29:49 2016 +0800

    merge with --no-ff
  • 添加包含信息的标签

git tag -a <标签名> -m "信息" <提交ID>

houbinbindeMacBook-Pro:git-demo houbinbin$ git tag -a v0.1 -m "首次提交标签" 965cf5d
houbinbindeMacBook-Pro:git-demo houbinbin$ git show v0.1
tag v0.1
Tagger: “houbb” <“1060732496@qq.com”>
Date:   Mon Oct 10 23:11:05 2016 +0800

首次提交标签

commit 965cf5db0b2ca8b062d2cd895b7431d37e11a23f
Author: houbinbin <1060732496@qq.com>
Date:   Mon Oct 10 18:05:43 2016 +0800

    first commit
  • 添加带有 PGP 签名的标签

git tag -s <标签名> -m "签名"

管理标签

houbinbindeMacBook-Pro:git-demo houbinbin$ git tag
v0.1
v0.9
v1.0
houbinbindeMacBook-Pro:git-demo houbinbin$ git tag -d v0.1
Deleted tag 'v0.1' (was 0fc098a)
houbinbindeMacBook-Pro:git-demo houbinbin$ git push origin v0.9
计数对象: 4, 完成。
压缩对象中: 100% (3/3), 完成。
写入对象中: 100% (4/4), 442 bytes | 0 bytes/s, 完成。
总共 4 (delta 1),复用 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.com/houbb/git-demo.git
 * [new tag]         v0.9 -> v0.9
houbinbindeMacBook-Pro:git-demo houbinbin$ git push origin --tags
计数对象: 3, 完成。
压缩对象中: 100% (2/2), 完成。
写入对象中: 100% (3/3), 361 bytes | 0 bytes/s, 完成。
总共 3 (delta 0),复用 0 (delta 0)
To https://github.com/houbb/git-demo.git
 * [new tag]         v1.0 -> v1.0
  • 移除本地标签

git tag -d <标签名>

  • 移除远程标签

git push origin :refs/tags/<标签名>

本文由博客一文多发平台 OpenWrite 发布!

相关推荐

  1. Git 版本控制系统-05-tags 标签管理

    2024-03-10 08:06:03       51 阅读
  2. Git 版本控制系统-04-branch manage 分支管理

    2024-03-10 08:06:03       49 阅读
  3. Git 版本控制系统-02-base usage 基本用法

    2024-03-10 08:06:03       48 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-10 08:06:03       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-10 08:06:03       100 阅读
  3. 在Django里面运行非项目文件

    2024-03-10 08:06:03       82 阅读
  4. Python语言-面向对象

    2024-03-10 08:06:03       91 阅读

热门阅读

  1. 百度信息流

    2024-03-10 08:06:03       51 阅读
  2. 百度AI千帆大模型示例代码 GO语言版

    2024-03-10 08:06:03       43 阅读
  3. Mac安装oh-my-zsh

    2024-03-10 08:06:03       41 阅读
  4. Centos下安装Redis6.X

    2024-03-10 08:06:03       48 阅读
  5. PHP伪协议详解

    2024-03-10 08:06:03       47 阅读
  6. 【MapReduce】02.Hadoop序列化

    2024-03-10 08:06:03       46 阅读
  7. Spring Boot面试系列-01

    2024-03-10 08:06:03       48 阅读
  8. 商品上传上货搬家使用1688商品采集api接口

    2024-03-10 08:06:03       37 阅读
  9. 基于MapReduce的汽车数据清洗与统计案例

    2024-03-10 08:06:03       39 阅读