How to stop git from tracking a file recent added to gitignore

Anirudh Yadav 2020-10-14 1 minute read
  1. Open Terminal and navigate to the local repository
  2. Ensure you are in the default branch
  3. Remove the file from the cache
  4. Commit
  5. Push the change
cd ...
git checkout master
git rm --cached <filename>
git commit -am 'Removed files from the index (now ignored)'
git push origin master