git1 - git中提示error: pathspec ‘xxx‘x did not match any file(s) known to git

在使用git commit时遇到pathspec错误,即使git status显示正常。原因是删除了上一版本的部分文件。解决方法包括使用git commit -a -m 'message'来自动暂存所有更改,或者直接使用git commit (-v)提交,但需要填写commit注释。
摘要由CSDN通过智能技术生成

1. 问题概述

最近在git中使用commit,将文件暂存到本地库时,有时候会报下面的错误

$ git commit -v '第一次提交'
error: pathspec '第一次提交' did not match any file(s) known to git

而通过 ‘git status’ 进程状态的查看是没有问题的,可以发现 git add xx 是成功的。

$ git status
On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)
        new file:   test1.c
        new file:   test2.c
        new file:   test3.c
        new file:   test4.c
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值