# Example .gitignore file for a JavaScript project

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](/git-removing-files-from-the-staging-area-and-the-tree)
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.json
```

## Further reading

- More on
  [`.gitignore` here](http://git-scm.com/book/en/Git-Basics-Recording-Changes-to-the-Repository#Ignoring-Files)
- See a huge set of
  [useful `.gitignore` files](https://github.com/github/gitignore)
