We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Gitignore

As you've seen, it's pretty normal to use the following workflow from the top level of your repo:

  1. git add .
  2. git commit -m "some message here"
  3. git push origin main

A problem arises when we want to put files in our project's directory, but we don't want to track them with Git. A .gitignore file solves this. For example, if you work with Python, you probably want to ignore automatically generated files like .pyc and __pycache__. If you are building a server, you probably want to ignore .env files that might hold private keys. If you (I'm sorry) work with JavaScript, you might want to ignore the node_modules directory.

Here's example contents of a .gitignore file, which exists at the root of a repo:

node_modules
.env

This will ignore every path matching node_modules as a path segment (directory name or file name). It ignores:

  • node_modules/code.js
  • src/node_modules/code.js
  • src/node_modules

It does not ignore:

  • src/node_modules_2/code.js
  • env/node_modules_3
  • src/node_modules.js

This will also ignore the .env file preventing you from committing sensitive environment variables (like API keys, DB credentials, etc.) ...cause that would be bad.

Assignment

root: 12345
admin: 54321
lane: 00000
prime: APICJJY$$PO!NJ@L
# Guilty Pleasures (tell no one)

- The Notebook
- The Love Guru
- Birdemic: Shock and Terror
- Troll 2
- Manos: The Hands of Fate
- Sharknado
touch .gitignore

A .gitignore is just a plain text file named ".gitignore". Edit it like any .txt or .md file.

Run and submit the CLI tests from the root of your project directory.