切换分支的时候,报了标题这么个错误,error: pathspec ''xxx did not match any file(s) known to git.

看见不能切换分支,我首先 git status 查看了一下当前状态,如下图

然后,就会发现,其实我的这个错误非常明显,就是在我的 beat 分支下有文件修改,所以切换不了。ok,解决方法:

  1. 如果修改的这些文件没什么用,完全可以删除。(我这儿的这些文件就是 mac 自动生成的,完全就可以使用这种方法)
rm -rf img/newIndex/.DS_Store img/newIndex/mobile/.DS_Store .DS_Store img/.DS_Store
  1. 根目录下添加 .gitignore 文件,将 .DS_Store 文件忽略即可

我这儿问题比较简单。接下来,记录一下此类问题的其他解决方案。参考了文章

## 清除缓存
git rm -r --cached .
## git add
git add .
## git commit
git commit -m "hopefully fixed pathspec error"

xxx did not match any file(s) known to git的更多相关文章

  1. git切换分支报错:error: pathspec 'origin/XXX' did not match any file(s) known to git

    项目上有一个分支test,使用git branch -a看不到该远程分支,直接使用命令git checkout test报错如下: error: pathspec 'origin/test' did ...

  2. Error: pathspec '*' did not match any file(s) known to git.

    git切换分支报错 error: pathspec 'develop' did not match any file(s) known to git. 解决办法如下: plumm@MACY-PC MI ...

  3. Git使用之(pathspec master did not match any file(s) known to git)

    一 问题概述 今天在工作中遇到一个问题,使用很久的一个local git repository,里面只有develop分支,那么现在想将分支切换到master分支,问题来了,在切换到master分支时 ...

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

    问题描述: 在远程服务器上新建裸仓库git  --bare init : git clone裸仓库到本地: 本地新建并切换分支xccdev,git checkout -b xccdev: 从xccde ...

  5. git commit 提交不了 error: pathspec 'project'' did not match any file(s) known to git.

    1. 问题--使用git将代码提交到码云,使用到以下命令时: git commit -m 'init project' # 报错 error: pathspec 'project'' did not ...

  6. git——创建分支后,切换分支报错(error: pathspec 'master' did not match any file(s) known to git)

    error: pathspec 'master' did not match any file(s) known to git 解决办法: 1.查看分支 git branch -a 2.获取所有分支 ...

  7. svn:Repository UUID 'XXX' doesn't match expected UUID 'YYY'

    About a month ago, CodePlex have upgraded their TFS servers to to TFS 2010. While this transition wa ...

  8. [iOS] file patterns: The `public_header_files` pattern did not match any file.

    由于之前集成私有pod,遇到问题, 默认的头文件目录设置为:s.public_header_files = ‘Pod/Classes/**/*.h’:但是如果Classes目录中,你的代码文件夹层次结 ...

  9. RLException: XXX is neither a launch file in package XXX nor is XXX a launch file name问题解决

    在运行roslaunch时出现了类似下面的错误: RLException: XXX is neither a launch file in package XXX nor is XXX a launc ...

随机推荐

  1. tomcat9 性能调优

    官网最靠谱 tomcat 参数官网: http://tomcat.apache.org/tomcat-7.0-doc/config/http.html   <Connector   port=& ...

  2. Codeforces 268B - Buttons

    Manao is trying to open a rather challenging lock. The lock has n buttons on it and to open it, you ...

  3. Python HTMLTestRunner 学习

    HTMLTestRunner 是 基于 unittest 单元测试的 HTML报告 的一个第三库   安装: 1. 安装:下载HTMLTestRunner.py文件:地址http://tungwaiy ...

  4. hive 中简单的udf函数编写

    .注册函数,使用using jar方式在hdfs上引用udf库. $hive.注销函数,只需要删除mysql的hive数据记录即可. delete from func_ru ; delete from ...

  5. js call 和 apply方法记录

    最近看到一篇很好的讲解apply和call的文章转了过来,若涉及版权问题请联系本人删除 1. 每个函数都包含两个非继承而来的方法:call()方法和apply()方法. 2. 相同点:这两个方法的作用 ...

  6. getopt_long_only

    st_i2c_parser.c中用到,遂学习一下: 参考:https://blog.csdn.net/pengrui18/article/details/8078813 https://blog.cs ...

  7. 火车时刻表WebApp

    关键词 :Ajax 跨域访问 php 同源策略 JQueryMobile 前言 在面试的过程中,兄弟连的徐老师提出要求我用JQuery Mobile(前端框架)来实现一个具有“火车时刻表”功能的Web ...

  8. 维护keepalived与mysql漂移脚本

    环境拓扑 chengAlived #!/bin/bash function checkModelone(){ echo "重新进行获取" wget 192.168.158.147: ...

  9. Android图片裁剪解决方案 -- 从相册截图

    在看Storage Access Framework,里面有一个加载相册图片的程序片断,可能是系统版本的问题,无法返回结果,这里找到一个适用于旧版本的方法. 在Android开发中,可以轻松调用一个I ...

  10. Vue父子组件生命周期

    转载自:https://blog.csdn.net/a8725585/article/details/79092505 vue父子组件钩子函数触发顺序 beforeMount后mounted前构造子组 ...