码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2017-01-04 00:04:27      阅读:1123      评论:0      收藏:0      [点我收藏+]

标签:pos   nbsp   user   rmi   .net   阶段   hub   push   not   

在看书 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

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

标签:pos   nbsp   user   rmi   .net   阶段   hub   push   not   

原文地址:http://www.cnblogs.com/alexyuyu/p/6246681.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!