I am in a situation where files have been committed to git. While doing git status -s files folder changes are showing. I have tried updating gitignore but itβs not working. I cannot delete the files folder and then update gitignore file with sites/*/files because I have a running application.
Asked
Active
Viewed 201 times
-3
-
Does this answer your question? [How can I delete a file from a Git repository?](https://stackoverflow.com/questions/2047465/how-can-i-delete-a-file-from-a-git-repository) β Antonio Petricca Jun 18 '21 at 12:02
-
Are you looking for this https://stackoverflow.com/questions/2047465/how-can-i-delete-a-file-from-a-git-repository/2047477 ? β Antonio Petricca Jun 18 '21 at 12:02
-
I don't have to remove the file if I use git rm -R folder do I lose data. β Nishant kumar Jun 18 '21 at 16:10
1 Answers
2
- add <File/Dir> in .gitignore
2)git rm -r --cached <File/Dir>
The command will remove it from git repository only and as it is part of gitignore, the removed directory or file will not be pushed to remote repo. Any further changes to dir will remain untracked.

Vinayagam R
- 101
- 4