← Lessons/Your First Commit

Your first commit

Git is how every team tracks changes to code. The core loop is three moves: turn a directory into a repository, stage a change, and commit it as a permanent snapshot. You'll do each one in its own step.

The terminal works like a real shell: your session carries over from one command (and one mini lesson) to the next. This sandbox starts with a README.md already in the folder.

gitversion-control

Interview prep

The init → add → commit loop is the most basic thing every engineer is expected to know cold.

What's the difference between git add and git commit?

git add stages a change — it moves it into the index (the staging area), the set of changes that will go into the next snapshot. git commit records everything currently staged as a permanent commit in the history. The two-step design lets you choose exactly which changes belong in a commit rather than committing everything at once.