Why Ignore Files
Part of the Version Control section of Coddy's Terminal journey — lesson 19 of 58.
Most real projects produce files you do not want in version control: build outputs, logs, environment secrets, editor caches, and files generated by tools.
Tracking those files would clutter every git status output, bloat the repository, and risk leaking sensitive data like API keys.
Git solves this with a special file called .gitignore. It lives at the root of your repo and lists patterns Git should skip.
node_modules/
.env
*.log
build/Files matching any pattern in .gitignore become invisible to Git: they will not show up as untracked, will not be stageable, and will not be committed.
The .gitignore file itself is usually committed to the repo so everyone working on the project shares the same ignore rules.
Challenge
BeginnerThe folder contains app.js and a junk file debug.log. Initialize the repo, create a .gitignore file containing the single line *.log, then run git status --short.
Only .gitignore and app.js should appear as untracked. debug.log should not.
Cheat sheet
.gitignore lists patterns for files Git should skip (untracked, unstageable, uncommitted). Place it at the repo root and commit it.
node_modules/ # ignore a directory
.env # ignore a specific file
*.log # ignore by extension
build/ # ignore a build folderTry it yourself
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Version Control
2Getting Started
Initialize A RepositoryThe .git FolderConfigure Your IdentityGit StatusRecap - First Repo8Merging
What Is A MergeFast-Forward MergeThree-Way MergeMerge ConflictsResolve A ConflictRecap - Merge Master11Feature Branch Project
Project OverviewInitialize Main3Tracking Changes
The Staging AreaGit AddGit CommitModifying A Tracked FileGit LogRecap - First Commits6Recipe Site Project
Project OverviewInitialize And Ignore