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 control. For example, my .gitignore (which is already added to git) file might be different than what my coworker wants it to be (e.g. I want to ignore Vim files). Whenever I make changes to this file, git shows it as a modified file. So my questions:
If you want to exclude files that are specific to your process (such as Vim temporary files), edit the (local) file .git/info/exclude
and add your exclusion patterns there. This file is designed for developer-specific exclusions rather than .gitignore
, which is designed for project-wide exclusions.
The short summary is, everybody should agree on what is added to .gitignore
. For files where you don't agree, use .git/info/exclude
.