在看书 FlaskWeb开发:基于Python的Web应用开发实战 时,下载完源码后 git clone https://github.com/miguelgrinberg/flasky.git

试着 切换到 提交历史 1a, $ git checkout 1a,出现error:

fatal: Not a git repository (or any of the parent directories): .git

这个提示表明现在不在一个git repository目录下,需要切换到flasky下面:

$ pwd
/c/Users/dell/Documents/GitHub/flasky

然后执行即可:

$ git checkout 1a
Note: checking out '1a'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

git checkout -b <new-branch-name>

HEAD is now at 7e1e156... Chapter 1: initial version (1a)

dell@dell-PC ~/Documents/GitHub/flasky ((1a))

1、git tag -a 'tag1' -m '备注tag1' HEAD //在本地代码的地方新增一个标签
2、git push origin tag1 //把到这个标签的代码push到仓库中
3、git show tag1 //查看标签内容
4、git tag //查看有哪些标签
5、git tag -d tag1 //删除标签

Git跟其它版本控制系统一样,可以打标签(tag), 作用是标记一个点为一个版本号,如0.1.3, v0.1.7, ver_0.1.3.在程序开发到一个阶段后,我们需要打个标签,发布一个版本,标记的作用显而易见。

下面介绍一下打标签,分享标签,移除标签的操作命令。

打标签

    git tag -a 0.1.3 -m “Release version 0.1.3″

    详解:git tag 是命令

-a 0.1.3是增加 名为0.1.3的标签

        -m 后面跟着的是标签的注释

    打标签的操作发生在我们commit修改到本地仓库之后。完整的例子

        git add .

        git commit -m “fixed some bugs”

        git tag -a 0.1.3 -m “Release version 0.1.3″

分享提交标签到远程服务器上

    git push origin master

    git push origin --tags

    –tags参数表示提交所有tag至服务器端,普通的git push origin master操作不会推送标签到服务器端。

删除标签的命令

    git tag -d 0.1.3

删除远端服务器的标签

    git push origin :refs/tags/0.1.3

最新文章

  1. 《CSS权威指南》读书笔记
  2. 将Jquery序列化后的表单值转换成Json
  3. shell学习之路:重定向符号的使用
  4. 论元数据和API管理工具
  5. freemarker语法简介
  6. framework 安装出错 1603
  7. Oracle Database does not provide any supplemental logging, which means that by default LogMiner is not usable
  8. PHP实现简单爬虫
  9. (WinForm)文件夹状态监控,最小化到托盘,开机自启动
  10. Activiti第三篇【连接、排他网关、指定任务处理人、组任务】
  11. one 策略模式 strategy
  12. CSS3中nth-of-type和nth-last-of-type
  13. Hadoop问题:Incorrect configuration: namenode address dfs.namenode.rpc-address is not configured
  14. pta编程总结2
  15. CSS margin 外边距 属性的位置关系
  16. JavaScript中变量、执行环境、作用域与C#中的异同
  17. 【HDU - 4349】Xiao Ming&#39;s Hope
  18. CentOS7使用yum命令安装Java1.8
  19. Spring Cloud开发实践 - 03 - 接口实现和下游调用
  20. 判断是否有TrueType字体

热门文章

  1. Python NaN
  2. Connect to Office365
  3. UI输入控件
  4. 简单的maven配置
  5. PHPstorm同步文件时与ftp断开连接
  6. BZOJ3932: [CQOI2015]任务查询系统
  7. HDU 4081Qin Shi Huang&#39;s National Road System(次小生成树)
  8. web前端基础知识-(六)Django基础
  9. web前端基础知识-(五)jQuery
  10. AJAX应用小案例