DEV Community

Discussion on: 11 Painful Git Interview Questions You Will Cry On

Collapse
 
harish1996 profile image
harish1996

Q10: How to remove a file from git without removing it from your file system?

I think a better way to do this is git rm --cached filename ?? Correct me if i am wrong !

Collapse
 
subbramanil profile image
Subbu Lakshmanan

You are correct. From git-rm documentation

--cached
Use this option to unstage and remove paths only from the index. Working tree files, whether modified or not, will be left alone.