Junior Version Control

What is .gitignore and how is it used?

The .gitignore file tells Git which files or directories it should ignore when tracking

changes. This is useful for files that aren’t necessary in the repository, like log files, compiled

binaries, or local configuration files.

Real-World Example:

If you're working on a Node.js project, you likely don’t want to track the node_modules/

directory, since it can be recreated by running npm install. You can add

node_modules/ to your .gitignore file to ensure that Git doesn't track those files.

More from Developer Essentials

All questions for this course