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:
git config --global core.excludesFile "c:/users/soltys/.gitignore"
That file behavies exactly like .gitignore
.
Order of reading gitignore files
- Pattern given add command itself
.gitignore
in repository as close as possible to given file.git/info/exclude
- file set by config in variable
core.excludesFile