If we look at a bunch of random open-source projects, they all instead try to exclude every known undesirable file, e.g.
This setup means that whenever a new developer joins the team or a new tool is adopted by someone in a team, you need to update
.gitignore configuration. Examples of this include
.vscode (IDE specific),
.next (tool specific),
.DS_Store (OS specific).
A better solution is "ignore everything with exclusions". In practice, this means that you ignore all files (or at least all hidden files) by default and add exceptions to those files that were agreed to be added to the project, e.g.
coverage dist node_modules package-lock.json *.log .* !*/*.babelrc.js !.dockerignore !.editorconfig !.eslintignore !.eslintrc !.gitignore !.gitlab-ci.yml !.npmignore !.storybook !.npmrc !.prettierignore
In this project we are ignoring all files that start with a dot, but we've added exceptions to the configuration files that belong to the project.
This configuration also ensures that you do not accidentally commit private files (keys) that are conventionally prefixed with a dot too.
Adopting this convention will save back-and-forth discussing what exclusions should be added to