Programming foundations

Stage 2 · Lesson 2 of 8

status, add, diff and commit

Command line and Git

records snapshots of your project called . You will run the same hundreds of times. git status shows what changed.

git diff shows the changes line by line. git add puts the changes you choose into the , a waiting room for the next commit. git commit -m "message" saves that snapshot.

The staging area exists so that one commit holds one logical change, even when you edited several things; git add -p lets you stage just parts of a file. Commit small and often. Write that say why, such as "Reject negative amounts in budget input", rather than "fix".

git log --oneline shows the history. Run git status before and after every command until it is a habit.

A question to check yourself, an AI practice session and 3 cheat sheet entries 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?