我想从 Git 中删除 ~/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
此错误消息建议我使用以下路径,因为 ~/.vim/** 不起作用
~/.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
如何从 Git 中删除 ~/.vim 中的所有文件和子目录?
--
git rm -r --cached ~/.vim/*
fatal: pathspec '.vim/colors' did not match any files
1/ 你不需要 '*
':
git rm -r --cached ~/.vim
将处理任何跟踪的子文件。
2/ fatal: pathspec '.vim/colors' did not match any files
只是意味着您在 1/ 中列出的命令起作用之前尝试过的命令之一,并且没有更多文件可删除!
# 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
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)