• 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  [...] -- [...]'
    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
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 添加包含信息的标签

    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
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 添加带有 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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 移除本地标签

    git tag -d <标签名>

    • 移除远程标签

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

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

  • 相关阅读:
    HDTune和CrystalDiskInfo硬盘检测S.M.A.R.T.参数当前值最差值阈值
    大数据Hadoop入门教程 | (二)Linux
    LeetCode 2341. 数组能形成多少数对
    ES模块化的导入和导出
    132、LeetCode-72.编辑距离
    基于Spring Boot和Spring Cloud实现微服务架构学习(四)-Spring Cloud总结
    Linux中的软件安装
    8c sql手册 六
    BruceR 包中介效应结果不一致?
    SQL注入
  • 原文地址:https://blog.csdn.net/ryo1060732496/article/details/136590961