Programming foundations

Stage 2 · Lesson 3 of 8

What to commit and .gitignore

Command line and Git

A should hold your source code and the files needed to build it. It should not hold what your tools generate, and it must never hold secrets. A .gitignore file lists patterns for , ones should not track.

Typical entries are virtual environments and node_modules, build output such as bin/, build/ or __pycache__/, editor folders, and .env files holding . Add it in the first commit, because .gitignore does not untrack a file Git already follows; for that you need git rm --cached.

The expensive mistake is committing a password or key. Removing it in a later commit still leaves it in the history, so you must revoke the key (cancel it and make a new one). keeps ready-made .gitignore templates for each language.

A question to check yourself, an AI practice session and 1 cheat sheet entry come when you add the roadmap to your account. Add it

Resources for this stage

Start with· follow one of these

Practise

  • Draws the commit graph as you type, so merge and rebase stop being a mystery

  • Levels 0 to 15 build real shell reflexes: finding files, reading them, permissions

Keep handy

  • Free official book: read chapters 1 to 3, keep the rest for later

  • Recovery recipes for the day a commit goes wrong

Also worth your time

Mark this stage as not done?