zoukankan      html  css  js  c++  java
  • Git tag 标签操作

    列表

    # 列出已有的标签
    $ git tag
    
    # 为了能及时看到远程上新增的标签, 在上面的命令之前可以fetch一下
    git fetch --all --tags --prune
    
    # 列出匹配的部分标签, 通配符 * 
    $ git tag -l 'v1.8.5*'
    

    查看

    # 查看标签明细
    # 通过-a 创建的标签, 使用git show 能看到标签的详细信息, 而轻量标签, 看到的只是对应的commit的信息
    $ git show [tag name]
    

    .创建

    # 创建轻量标签
    $ git tag v1.4-lw
    # 创建附注标签, 用 -a 代表为附注标签, 这时候必须带 -m 参数
    $ git tag -a v1.4 -m '评论my version 1.4'
    
    # 事后补打标签
    $ git tag -a v1.2 [commit hash]
    
    # 将指定的标签push到远程
    $ git push origin v1.5
    # 将本地有, 但是服务器上没有的的标签都push到远程 $ git push origin --tags

    删除

    # 删除本地标签
    git tag -d V1.2
    
    # 删除后, 将删除同步到远程(删除远程的标签)
    git push origin :refs/tags/V1.2
    

    .检出

    # checkout指定标签到本地的新分支
    git checkout tags/${TAG} -b ${BRANCH_NAME}
    
    # checkout一个临时分支, 用于查看, 不能修改
    git checkout ${TAG}
    

    .

  • 相关阅读:
    0401. Binary Watch (E)
    0436. Find Right Interval (M)
    0151. Reverse Words in a String (M)
    1344. Angle Between Hands of a Clock (M)
    0435. Non-overlapping Intervals (M)
    0434. Number of Segments in a String (E)
    0063. Unique Paths II (M)
    0062. Unique Paths (M)
    0100. Same Tree (E)
    0190. Reverse Bits (E)
  • 原文地址:https://www.cnblogs.com/milton/p/10085758.html
Copyright © 2011-2022 走看看