DEV Community

Discussion on: Gitignore Revisited

Collapse
 
nylen profile image
James Nylen

The .gitignore file for a project should only contain files directly related to that project, not anything that might vary by OS or editor or IDE, because this just clutters things up.

These files should be placed in a global .gitignore file for your whole computer instead: help.github.com/en/github/using-gi...

Collapse
 
eclecticcoding profile image
Chuck

James, thank you for your response. You are correct, this approach I use does create a large .gitignore file. In a perfect scenario, all contributing users would maintain a local global .gitignore file to exclude their own OS and editors, but unfortunately this is not the case. I have contributed on many Open Source projects that were littered with superfluous files. The biggest culprits are editor temporary files. The fix for me is a more robust gitignore file.

You do raise an interesting point though. I will include a new section to the article which includes the global .gitignore and how to properly configure.

Again, thank you for your contributions.

Collapse
 
nylen profile image
James Nylen

I prefer keeping all code including the .gitignore file as clean as possible, even if it means more carefully reviewing each change for stray files (something that project maintainers should be doing anyway) and educating people about how to use a global .gitignore file.