Question : Apply .gitignore on an existing repository
Answered by : ahsan-habib
First of all, commit all pending changes.
Then run this command:
git rm -r --cached .
This removes everything from the index, then just run:
git add .
Commit it:
git commit -m ".gitignore is now working"
Source : https://stackoverflow.com/questions/19663093/apply-gitignore-on-an-existing-repository-already-tracking-large-number-of-file | Last Update : Wed, 19 Jan 22