zoukankan      html  css  js  c++  java
  • Git 标签管理

    标签类似于快照的功能,可以给版本库打一个标签,记录某个时刻库的状态,也可以随时恢复到该状态

    git tag                # 查看所有标签
    git tag <tag_name>     # 给当前所在的分支打标签
    git show <tag_name>    # 查看指定标签的详细信息
    git tag -d <tag_name>  # 删除指定的标签

    针对分支打标签:

    [root@localhost ~]$ cd /data/git
    [root@localhost git]$ git checkout master    # 切换到需要打标签的分支
    [root@localhost git]$ git tag v1.0           # 给当前所在的分支打标签
    [root@localhost git]$ git show v1.0          # 查看指定标签的详细信息

    针对历史的 commit 信息打标签:

    [root@localhost git]$ git log --pretty=oneline --abbrev-commit         # 查看历史的commit信息
    [root@localhost git]$ git tag -a v4.0 -m 'Merge branch dev' e40937d    # 对指定的commit信息打标签,-m 指定对标签的描述信息

    如何推送或删除标签:

    [root@localhost git]$ git push origin v1.0               # 推送指定的标签到远程
    [root@localhost git]$ git push --tag origin              # 推送所有的标签到远程
    [root@localhost git]$ git tag -d v1.0                    # 删除本地标签
    [root@localhost git]$ git push origin :refs/tags/v1.0    # 删除远程标签

        

  • 相关阅读:
    Linux基础文件打包
    Linux基础文件查找
    Apache的三种工作模式及相关配置
    elasticsearch启动错误整理
    Zabbix-agentd错误整理
    Nginx编译安装
    PHP编译安装
    Zabbix编译安装(全)
    Chetsheet: 2017 01.01 ~ 01.31
    Cheatsheet: 2016 12.01 ~ 12.31
  • 原文地址:https://www.cnblogs.com/pzk7788/p/10294219.html
Copyright © 2011-2022 走看看