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

    允许有意义的名称到一个特定的版本库中的标签操作。Tom 决定标记他们的项目代码,以便他们以后可以更容易访问。

    创建标签

    让我们标记当前HEAD使用git tag命令。他提供的标记名称前加上-a选项,使用-m选项,并提供标签信息。

    tom@CentOS project]$ pwd /home/tom/top_repo/project

    [tom@CentOS project]$ git tag -a ‘Release_1_0′ -m ‘Tagged basic string operation code’ HEAD

    如果想标记特定提交然后使用适当的COMMIT ID,而不是HEAD 指针。 Tom使用下面的命令推到远程存储库中的标签。

    [tom@CentOS project]$ git push origin tag Release_1_0

    上面的命令会产生以下结果。

    Counting objects: 1, done. Writing objects: 100% (1/1), 183 bytes, done. Total 1 (delta 0), reused 0 (delta 0) To gituser@git.server.com:project.git * [new tag] Release_1_0 −> Release_1_0

    查看标签

    Tom 创建标签。现在,Jerry 可以查看所有可用标签通过使用Git tag命令使用-l选项。

    [jerry@CentOS src]$ pwd /home/jerry/jerry_repo/project/src

    [jerry@CentOS src]$ git pull remote: Counting objects: 1, done. remote: Total 1 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (1/1), done. From git.server.com:project * [new tag] Release_1_0 −> Release_1_0 Current branch master is up to date.

    [jerry@CentOS src]$ git tag -l Release_1_0

    Jerry 使用Git的show命令后跟标记名称的有关标签查看更多细节。

    [jerry@CentOS src]$ git show Release_1_0

    上面的命令会产生以下结果。

    tag Release_1_0 Tagger: Tom Cat <tom@yiibai.com> Date: Wed Sep 11 13:45:54 2013 +0530 Tagged basic string operation code commit 577647211ed44fe2ae479427a0668a4f12ed71a1 Author: Tom Cat <tom@yiibai.com> Date: Wed Sep 11 10:21:20 2013 +0530 Removed executable binary diff –git a/src/string_operations b/src/string_operations deleted file mode 100755 index 654004b..0000000 Binary files a/src/string_operations and /dev/null differ

    删除标签

    Tom使用下面的命令来删除标记从本地以及远程仓库。

    [tom@CentOS project]$ git tag Release_1_0

    [tom@CentOS project]$ git tag -d Release_1_0 Deleted tag ‘Release_1_0′ (was 0f81ff4) # Remove tag from remote repository.

    [tom@CentOS project]$ git push origin :Release_1_0 To gituser@git.server.com:project.git – [deleted] Release_1_0

    PS:如果您想和业内技术大牛交流的话,请加qq群(521249302)或者关注微信公众 号(AskHarries),谢谢!

  • 相关阅读:
    jquery点滴总结
    优雅降级和渐进增强的区别
    editplus 常用
    whm 设置共享IP
    php抓取页面的几种方法详解
    上传数据插件 Easy Populate 遇到问题 ?langer=remove
    zencart里常用 SQL
    5个简单的步骤把 WordPress 打造成 CMS
    基于PHP的cURL快速入门
    常用软件、插件名称
  • 原文地址:https://www.cnblogs.com/kluan/p/6021379.html
Copyright © 2011-2022 走看看