zoukankan      html  css  js  c++  java
  • git tag的应用

    一,git的tag是什么?

          tag就是给commit起一个容易记忆容易理解的名字

    说明:架构森林是一个专注架构的博客,地址:https://www.cnblogs.com/architectforest

             对应的源码可以访问这里获取: https://github.com/liuhongdi/

     说明:作者:刘宏缔 邮箱: 371125307@qq.com

    二,给当前的commit打一个tag,名字就叫 e

    root@kubuntu:/data/git/clog# git tag e

    三,查看当前所有的tag

    root@kubuntu:/data/git/clog# git tag
    e

    四,给指定的某个commit添加tag,名字是:a

    root@kubuntu:/data/git/clog# git tag a cda25664a84b8a27fedbaf436e302781e51fc0e9

    五,从git log中可以看到添加的tag和commit的对应关系

    root@kubuntu:/data/git/clog# git log --pretty=oneline
    6a1ea30d1f70c747d9f2bb6282b1f6b2e75ccf05 (HEAD -> dev, tag: e) e
    89a1b44dc8c491742382f0cb7d528a5652023ee9 d
    c1d316f17dcbe0c8ee42361ffaaa19fa7c8ff616 (master) c
    31b4f3173bd46947a671db7a174b4044aca617c1 b
    cda25664a84b8a27fedbaf436e302781e51fc0e9 (tag: a) a
    7f5d3f71a244920c390b761921687adafcdf8b45 初始化文件

    六,tag 可以代替commit id 使用:

          看一个例子:

    root@kubuntu:/data/git/clog# git show a
    commit cda25664a84b8a27fedbaf436e302781e51fc0e9 (tag: a)
    Author: liuhongdi <371125307@qq.com>;
    Date:   Mon Feb 17 13:09:22 2020 +0800
        a
    diff --git a/a.txt b/a.txt
    index 07891fc..160418f 100644
    --- a/a.txt
    +++ b/a.txt
    @@ -1 +1,2 @@
     version orig
    +a

    七,删除一个tag

    root@kubuntu:/data/git/clog# git tag -d e
    已删除标签 'e'(曾为 6a1ea30)
  • 相关阅读:
    C# Apache Thrift Demo
    C#指针使用demo
    C#中指针使用总结
    fastjson之JSONObject、JSONArray
    fastjson使用
    ObjectMapper使用
    ObjectMapper将json转对象报错处理
    rabbitmq-channel方法介绍
    rabbitmq不同模式的交换机使用
    activemq总结
  • 原文地址:https://www.cnblogs.com/architectforest/p/12323245.html
Copyright © 2011-2022 走看看