clubmate.fi

A good[ish] website

Web development blog, loads of UI and JavaScript topics

Example .gitignore file for a JavaScript project

Filed under: Tooling— Tagged with: git

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 .gitignore file is simple: stuff in it doesn’t get added to Git. Lines starting with # are comments.

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.json

Further reading

Comments would go here, but the commenting system isn’t ready yet, sorry. Tweet me @hiljaa if you want to make a correction etc.

  • © 2021 Antti Hiljá
  • About
  • Follow me in Twatter → @hiljaa
  • All rights reserved yadda yadda.
  • I can put just about anything here, no one reads the footer anyways.
  • console.log('Smash the patriarchy!')
  • I love u!