Search code examples
linuxgitdrupal-8

How to ignore files folder after committed to git for drupal 8 server?


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.


Solution

    1. 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.