Stage 5 · Lesson 4 of 8
.gitignore and what never goes in Git
A .gitignore file lists files and folders Git should not track. Typical entries are downloaded such as node_modules, build output, logs, editor files and, above all, secrets such as .env files and keys. Add it at the very start of a project; 's ready-made templates are a good base.
There is a catch: ignoring a file Git already tracks does nothing. You must first remove it from the with git rm --cached. Treat anything pushed to a public as public for ever, even after you delete it.
Common trapcommitting an , deleting it in the next commit and assuming it is gone; it is still in history and must be revoked.
A question to check yourself, an AI practice session and 2 cheat sheet entries come when you add the roadmap to your account. Add it
Resources for this stage
Start with· follow one of these
- BookFreePro Git
Scott Chacon and Ben Straub
The free official Git book; chapters 2 and 3 cover everything in this stage properly
- CourseFreeThe Missing Semester of Your CS Education
MIT · Beginner
The version control lecture teaches Git from its data model upwards, which makes commands make sense
Practise
Keep handy
Also worth your time
- roadmap.sh: Git and GitHubGo deeper
A map of Git and GitHub topics, from basics to hooks, submodules and Actions