无法从Git递归移除文件 [英] Unable to remove files recursively from Git
问题描述
<$ p $
我想从〜/ bin / p> git rm -r --cached〜/ .vim / *#感谢Pate寻找--cached!
我得到
fatal:pathspec'.vim / colors'与任何文件都不匹配
messsage建议我使用以下PATH,因为〜/ .vim / **不起作用
〜/ .vim / * #我得到错误
〜/ .vim / * / * / *#这将从〜/ .vim / folderA / folderB / file1.txt中的索引中删除文件
〜/ .vim / * / *#与第一个PATH类似的错误
如何删除所有文件和子目录〜/ .vim from Git?
-
git rm -r --cached〜/ .vim / *
fatal:pathspec'.vim / colors'与任何文件不匹配
1 /您不需要' *
':
git rm -r --cached〜/ .vim
会照顾任何追踪的子文件。
2 / 致命: pathspec'.vim / colors'不匹配任何文件
仅仅意味着你在1/1中列出的命令之前尝试过的一个命令,并且没有更多的文件可以删除!
#测试该命令,首先重新初始化存储库的状态
#如果您有任何其他当前修改,则先保存
$ git reset --hard
#然后检查rm工程
$ git rm -r --cached〜/ .vim
rm'.vim / aPath / aFile1'
rm'.vim / aSecondPath / aFile2'
rm'.vim / aThirdPath / aFile3'
#再次尝试
$ git rm -r --cached 〜/ .vim
fatal:pathspec'.vim / colors
I want to remove all files from Git at ~/bin/.
I run
git rm -r --cached ~/.vim/* # Thanks to Pate in finding --cached!
I get
fatal: pathspec '.vim/colors' did not match any files
This error messsage suggests me to use the following PATHs, since ~/.vim/** does not work
~/.vim/* # I get the error
~/.vim/*/*/* # This removes files from the index at ~/.vim/folderA/folderB/file1.txt
~/.vim/*/* # similar error as to the first PATH
How can you remove all files and subdirectories at ~/.vim from Git?
--
git rm -r --cached ~/.vim/*
fatal: pathspec '.vim/colors' did not match any files
1/ You do not need the '*
':
git rm -r --cached ~/.vim
will take care of any tracked sub-files.
2/ fatal: pathspec '.vim/colors' did not match any files
simply means one of your commands you tried before the one listed in 1/ has worked, and there is no more file to delete!
# to test that command, first reinitialize the state of the repository
# save first if you have any other current modifications
$ git reset --hard
# then check the rm works
$ git rm -r --cached ~/.vim
rm '.vim/aPath/aFile1'
rm '.vim/aSecondPath/aFile2'
rm '.vim/aThirdPath/aFile3'
# try it again
$ git rm -r --cached ~/.vim
fatal: pathspec '.vim/colors
这篇关于无法从Git递归移除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!