skip to Main Content
How To Ignore Files Only On My Machine?

How to ignore files only on my machine?

If we want to ignore files (they will not suggested to be added as staged) we usually use .gitignore in root folder of our repository. There is one problem this file is shared between all contributers of that repository.

What to do when we want add filter only on our machine? For example only we use somekind tool or extension which generates some sort of files.

We have two options.

exclude file for local repository

When you go to a <repository_location>/.git/info/exclude, if file doesn’t exists create one.

That file behavies exactly like .gitignore.

gitignore system wide

You need to set git config for global .gitignore file, by doing running command:

That file behavies exactly like .gitignore.

Order of reading gitignore files

  1. Pattern given add command itself
  2. .gitignore in repository as close as possible to given file
  3. .git/info/exclude
  4. file set by config in variable core.excludesFile

Sources

Back To Top