Skip to content

Summary: Your first repo

L1 taught the snapshot mental model. L2 turned the model into commands. You now have a working procedure for starting a tracked project and saving snapshots.

working directory -> staging area -> repository
(edit) (git add) (git commit)

The working directory is what is on disk. The staging area is a draft of the next snapshot. The repository is permanent history.

CommandPurpose
git initCreate a new repository in the current folder. Once per project.
git statusShow the state of working directory + staging area + most recent commit. Run it often.
git add <file>Move changes from working directory into staging area.
git commit -m "msg"Take a snapshot of the staging area, with a message.
(and) .gitignoreA file that lists patterns git should never track.

The five things that always belong in .gitignore

Section titled “The five things that always belong in .gitignore”
  1. Compiled output (dist/, build/)
  2. Dependencies (node_modules/)
  3. Editor files (.idea/, .vscode/, .swp)
  4. Secrets (.env, credentials, anything with a password)
  5. OS artifacts (.DS_Store, Thumbs.db)

.gitignore patterns with trailing slash (node_modules/) match directories only, not symlinks. Use bare name (node_modules) to match both.

Muscle memory for the commit cycle. L3 teaches what makes a commit MEANINGFUL. The mechanics are now yours; the discipline is what comes next.

Git stores snapshots. Every other command is just navigating those snapshots.