• git杂记-打标签


    1. 列出标签
      $ git tag
      v0.1
      v1.3
    2. 创建标签
      --添加附注标签(推荐):加上-a选项(annotated)
      $ git tag -a v1.4 -m 'my version 1.4'
      
      --添加轻量标签
      $ git tag v1.4-lw

      --后期打标签(需要记住相关的提交集),可以利用指令git log --pretty=online查看相关的提交集
      $ git tag -a v1.2 9fceb02
       
    3. 展示标签的内容
      $ git show v1.4
      tag v1.4
      Tagger: Ben Straub <ben@straub.cc>
      Date:   Sat May 3 20:19:12 2014 -0700
      
      my version 1.4
      
      commit ca82a6dff817ec66f44342007202690a93763949
      Author: Scott Chacon <schacon@gee-mail.com>
      Date:   Mon Mar 17 21:52:11 2008 -0700
      
          changed the version number
    4. 推送标签信息到远程服务器;git push 命令并不会传送标签到远程仓库服务器上,要运行 git push origin [tagname]
      --推送指定的标签到远程服务器
      $ git push origin v1.5 Counting objects: 14, done. Delta compression using up to 8 threads. Compressing objects: 100% (12/12), done. Writing objects: 100% (14/14), 2.05 KiB | 0 bytes/s, done. Total 14 (delta 3), reused 0 (delta 0) To git@github.com:schacon/simplegit.git * [new tag] v1.5 -> v1.5

      --推送所有标签到远程服务器
      $ git push origin --tags
      Counting objects: 1, done.
      Writing objects: 100% (1/1), 160 bytes | 0 bytes/s, done.
      Total 1 (delta 0), reused 0 (delta 0)
      To git@github.com:schacon/simplegit.git
       * [new tag]         v1.4 -> v1.4
       * [new tag]         v1.4-lw -> v1.4-lw
    5. 从特定的标签处签出并修改:git checkout -b [branchname] [tagname]
      $ git checkout -b version2 v2.0.0
      Switched to a new branch 'version2'

      --当然,如果在这之后又进行了一次提交,version2 分支会因为改动向前移动了,那么 version2 分支就会和 v2.0.0 标签稍微有些不同。
      这时就应该当心了。因为分支会有版本迭代,标签所在的版本不会变。
  • 相关阅读:
    Blocks to Cubes
    poj1113凸包
    AtCoder Regular Contest 078D
    Codeforces Round #400
    hdu2196树形dp
    Codeforces Round #409
    Codeforces Round #424
    hdu1520树形dp第一题
    Codeforces Round #412
    poj2823单调队列
  • 原文地址:https://www.cnblogs.com/oufeng/p/6663523.html
Copyright © 2020-2023  润新知