Add some file patterns to one of Git's ignore files.
- The
.gitignore
file is usually committed with the repository, so its ignores are shared by all users. - The
.git/info/exclude
file is not committed with the repository, so it can be used for your own personal ignores.
To ignore all .js
file in a directory foo
, use something like this:
foo/*.js
Note that patterns in the ignore files only prevent files from being tracked. This means that if you have already committed a file, it will continue to be tracked. Modifications will cause the file to show up in your "uncommitted changes", and something like git commit -a
will cause changes to be committed.
If you have a committed file that you wish to ignore going forward, you will have to remove it from the repository. This is a frequent question on SO, and there are many questions about handling this.
It is worthwhile to read up on Git's ignore feature, as it has a few gotchas.