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

git遇到问题记录

时间:2017-05-19 22:17:56      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:status   dev   use   any   error:   初始化   include   mat   clu   

1. 简述:git init 后想要 git branch name  建新分支,报错 error: pathspec ‘name‘ did not match any file(s) known to git.

            使用git checkout -b dev强制建了个分支切过去,再想切回master,仍报 error: pathspec ‘master‘ did not match any file(s) known to git.

   原因:新初始化的库必须进行一次git commit操作才可以完成。

   解决:git status   //查看当前状态

                 On branch name

                 Initial commit

                 Untracked files:
                 (use "git add <file>..." to include in what will be committed)

                 readme.txt

                 nothing added to commit but untracked files present (use "git add" to track

           git add.     

           git commit  -m "init"    //添加commit

           git checkout name      //切换分支

                Already on ‘name‘

           git checkout master   //切换master,因为master没有进行过commit,所以没有实际上没有建立成功

                error: pathspec ‘master‘ did not match any file(s) known to git.

           git checkout -b master  //新建master分支并切换过去

               Switched to a new branch ‘master‘

           git checkout master   //切换到master分支

               Already on ‘master‘

           git checkout name   //切换到name分支

               Switched to branch ‘name‘

           git checkout -   //切换到master分支的简写

               Switched to branch ‘master‘

git遇到问题记录

标签:status   dev   use   any   error:   初始化   include   mat   clu   

原文地址:http://www.cnblogs.com/anywaywolf/p/6880240.html

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