Aaron Vance Aaron Vance - 7 months ago 34
Git Question

How to use git rm -cached to remove tilde file

I have

~$itial Problem Description.docx
file in my git repo.

I'm guessing its a recovery type file for Microsoft word.

I added it to the repo and pushed by accident.

When I try and do git
rm --cached ~$itial Problem Description.docx

It says -
'~ Problem Description.docx'
did not match any files

How do I
git rm --cached
this? And what do I put in my
to ignore it?


The problem is the shell is interpreting $itial as a (empty) environment variable because of the $. You can prevent the shell from parsing it by using single quotes:

$ git rm '~$itial Problem Description.docx'