Git : How to stop tracking a file

To stop tracking a file that was previously being tracked by git, do the following:

  • add the filename to the .gitignore file
  • execute the command git rm --cached <filename>

Git shall now stop tracking the file