标签: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‘
标签:status dev use any error: 初始化 include mat clu
原文地址:http://www.cnblogs.com/anywaywolf/p/6880240.html