Should .gitignore file be committed?
In general, yes. The project level .gitignore file should be committed to the repository.
The project level .gitignore file lives in the root of your git project and contains lines of list of files to ignore (which can contain wildcards such as ‘*.zip’).
This is not to be confused with the global user level .gitignore_global file which is set in the git config by …
git config –global core.excludesfile ~/.gitignore_global
git config –global core.excludesfile /Users/yourusername/.gitignore_global
The first example would be for Mac and the second example is of Windows.
The .gitignore_global is not committed and applies to all git projects of this user on this machine.
There is a collection of useful .gitignore template files here.