Untrack Local Files in Git

Sometimes we require to untrack files or folders that have already been added to a git repository. The following git command will stop tracking specified files or folders but keep the file in a git repository intact. This is good for files or directories that have auto generated files or need to be customized often (e.g configuration files). So everytime you do a git commit, you don’t have to commit a new copy of these (modified) files.

git rm --cached filename

replace filename to your preferred file name to be untracked on git.