SWE.for vibe coders
Lesson 2 of 412 min

Your first commit

The three-step rhythm — change, stage, commit — that every save point follows.


Now the hands-on part. Making a commit is a rhythm of three steps. Once it’s in your fingers, you’ll do it without thinking.

The three steps

  1. Change — you edit files. Git notices, but does nothing yet.
  2. Stage — you tell git which changes belong in the next snapshot (git add).
  3. Commit — you take the snapshot and label it (git commit).

Why two steps to save (stage then commit)? Because sometimes you change five things but only want to snapshot two of them together. Staging lets you choose. For now, it’s fine to just stage everything.

terminal
$git add .

The . means “everything I’ve changed.” This stages your changes — puts them on deck for the next commit.

terminal
$git commit -m "Add contact form to homepage"
[main a1b2c3d] Add contact form to homepage
1 file changed, 24 insertions(+)

That’s a save point. The -m is the message — a short note to your future self about what this snapshot contains.

Writing a good commit message

The message is you leaving a trail. Six months from now, scrolling through history, “fixed stuff” tells you nothing. “Fix login button not working on mobile” tells you everything.

Check yourself

Which of these is the most useful commit message?

Seeing your history

Once you have a few commits, git log shows them, newest first:

terminal
$git log --oneline
a1b2c3d Add contact form to homepage
9f8e7d6 Fix broken logo image
3c2b1a0 Initial commit

Each line is a save point: a short hash (the ID, like a1b2c3d) and your message. That top hash is where you are right now.

Check yourself

You've been coding for 20 minutes and the feature now works. What's the right instinct?

Try it for real

Time to actually do it. In any project you have locally (or a throwaway folder):

  1. Create a file — even just a notes.txt with one line in it.
  2. Run git status. See your file listed as untracked or modified.
  3. Run git add . then git status again — notice how the file moved to “staged.”
  4. Run git commit -m "My first real commit".
  5. Run git log --oneline and admire your save point.

If the folder isn’t a git project yet, run git init first to create the .git time machine. That’s it — you’ve made a commit.