Here’s an example .gitignore file for reference, which contains most of the things that need ignoring in a normal JavaScript project.
The concept of a .gitignore file is simple: files in it don’t get added to
Git. Lines starting with # are comments. If a file has already been committed,
removing it from Git's index
is a separate step.
Example file
Here’s an example file that I always use:
.env
.env-development
.env-production
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Dependency directories
node_modules/
jspm_packages/
# Optional npm cache directory
.npm
# Output of 'npm pack'
*.tgz
# Random crap
trash
.DS_Store
.sass-cache
.tmp
.rvmrc
.trashes
*~
# Gatsby related
.cache/
public
# Editor
.vscode
.vscode-test
*.sublime-project
*.sublime-workspace
sftp-config.jsonFurther reading
- More on
.gitignorehere - See a huge set of
useful
.gitignorefiles