Don’t forget you also have a personal gitignore file in $HOME/.config/git/ignore
Posted by jpluimers on 2026/05/28
The question in [Wayback/Archive] git – What will happen when a pull request includes changes to ignored .gitignore? – Super User comes down to:
I don’t want anybody to change what’s in my
.gitignorefile because it includes some things that are specific to my own system.
Those settings should go in a personal gitignore file, which is mentioned in the [Wayback/Archive] Git – gitignore Documentation
Which file to place a pattern in depends on how the pattern is meant to be used.
Patterns which should be version-controlled and distributed to other repositories via clone (i.e., files that all developers will want to ignore) should go into a.gitignorefile. Patterns which are specific to a particular repository but which do not need to be shared with other related repositories (e.g., auxiliary files that live inside the repository but are specific to one user’s workflow) should go into the$GIT_DIR/info/excludefile. Patterns which a user wants Git to ignore in all situations (e.g., backup or temporary files generated by the user’s editor of choice) generally go into a file specified bycore.excludesFilein the user’s~/.gitconfig. Its default value is$XDG_CONFIG_HOME/git/ignore. If$XDG_CONFIG_HOMEis either not set or empty,$HOME/.config/git/ignoreis used instead.
personal
.gitignoreshould go to a different place defined bycore.excludesFile,$HOME/.config/git/ignoreby default on Windows. And project.gitignoreshould include common files that can annoy anyone contributing to it.
--jeroen






Leave a comment