Git Ignore Files


Git has support for ignoring files via its .gitignore files.

This is extremely useful since it is usually desirable to avoid checking in files that are generated during a build. The gitignore files will also reduce the noise when you run git status.

Git’s .gitignore files are similar to CVS’s .cvsignore files and Subversion’s svn:ignore property. One major difference between them is a .gitignore will affect all subdirectories whereas CVS and Subversion only ignore files in the current directory. For example, if you put the following in the .gitignore file at the top level of your project:


then any file or directory within any directory of the repository that matches those patterns will be ignored by git.

Git will also exclude files which match patterns defined in <repo>/.git/info/exclude.

For more detailed information on .gitignore files:

$ git help ignore