The .gitignore file is very useful in ignoring some of the files that we don\'t want to control. Unfortunately, it cannot be used when the file is already under version cont
I cannot really answer the general question (having Git ignore tracked files) - it strikes me as a feature that would be much more detrimental than useful.
However, the gitignore manual page specifies a few ways to configure patterns for excluded files.
In particular, it gives explicit instructions on how to use these various ways:
- Patterns which should be version-controlled and distributed to other repositories via clone (i.e., files that all developers will want to ignore) should go into a
.gitignorefile.
Meaning that your .gitignore file should not be different from your coworkers - it is working as intended.
Patterns which are specific to a particular repository but which do not need to be shared with other related repositories (e.g., auxiliary files that live inside the repository but are specific to one user’s workflow) should go into the
$GIT_DIR/info/excludefile.Patterns which a user wants git to ignore in all situations (e.g., backup or temporary files generated by the user’s editor of choice) generally go into a file specified by
core.excludesfilein the user’s~/.gitconfig.
There you have it. Specify a core.excludesfile file path into your ~/.gitconfig file, and then put into it the patterns that you want to exclude.