.gitignore project files only¶
Quote
Ignorable files that the project creates should be in the project .gitignore file, ignorable files that stuff on your machine creates should go in the global .gitignore (like editor/IDE temp files and the like). — Pylinux on SO
Putting only project-related ignorable files there avoids cluttering your project's .gitignore
file with more and more directives collected over ages from "best practices" and developer preference.
Examples for project files to ignore:
node_modules/
# Gradle temporary files
target/
# (Java) Package Files #
*.jar
*.war
*.ear
# Java
*.class
# Logs and databases
*.log
*.sql
Examples for system files to ignore:
# IntelliJ files
**/*.iml
**/.idea
.vscode/
# OS generated files
.DS_Store
.Spotlight-V100
.Trashes
Thumbs.db
Info
A global .gitignore file must be placed on a location of your choice, e.g. ~/.gitignore
, and configured accordingly:
$ git config --global core.excludesFile '~/.gitignore'
$ git config --global core.excludesFile "%USERPROFILE%\.gitignore"
You can verify the correct location afterwards by executing the following:
$ git config --global core.excludesFile