Ignoring files in git

August 19, 2019

No, this isn’t a post about .gitignore

The .gitignore file is a great way to exclude files from a repository for all users. This post is not about that.

I often want to ignore files that a tool / editor I use generates in a project. Others who are working in the project may not be using these same tools so adding to a .gitignore file may not be the best solution.

Exclude file

There is the concept of a local exclude file in git. It works just like .gitignore but the file is not checked in.

It’s available at .git/info/exclude from a project directory.

Keep in mind

Files that should always be ignored should be specified in .gitignore. Files that you want to exclude locally could go in .git/info/exclude 👍


Ryan Lanciaux

Hi 👋 I'm Ryan Lanciaux. I run Spaceship Studio, LLC. a consultancy specializing in fast and dynamic web and native mobile applications.

I live in Ann Arbor with my wonderful family! In my freetime, I create electronic music.

You should follow me on Twitter