git rm -f *.json.gz
fatal: pathspec '01eece012a88a1a7077de645f44bbb71baf67cae.json.gz' did not match any files
git rm *.gz
fatal: pathspec '01eece012a88a1a7077de645f44bbb71baf67cae.json.gz' did not match any files
git rm *.*.gz
fatal: pathspec '01eece012a88a1a7077de645f44bbb71baf67cae.json.gz' did not match any files
Using
git rm
进行批量删除其实和rm
命令是一样的,都支持通配符。只是楼主没有正确理解git rm
的适用场合。git rm
适用于那些你要删除的文件已加入暂存区,而楼主的这些文件并未加入暂存区就使用git rm
,而git rm
will search for those files in the temporary storage area, but these files are not in the temporary storage area. At this time, of course, an error "No matching file" will be reported.So for files that have not been added to the temporary storage area, you can use the regular deletion method. It is not necessary to use
git rm
;而对于已经加入暂存区的文件使用git rm
which is a more reasonable deletion method.I think the poster may not have grasped the root cause of the error, and mistakenly thought that
git rm
不能像rm
also supports wildcards./q/10...
git add -A