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?
--
To remove a directory and all its contents, including any subdirectories and files, use the rm command with the recursive option, -r . Directories that are removed with the rmdir command cannot be recovered, nor can directories and their contents removed with the rm -r command.
gitignore" is very helpful, it tells me what files are excluded by . ignore. I was happy to find these commands, BUT it does not really remove the files from repository.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With