Keelmark Your record

Unit II · Saving and undoing

Commits are save points

Lesson 04 of 185 minSources checked Oct 17, 2026

Git records your project as a series of snapshots called commits. A commit before every big request to the AI means you can always get back to a version that worked.

What a commit is

A commit is a snapshot of the files you chose to include, with a message, an author and a time. The history is the chain of those snapshots. git status lists what has changed since the last commit, git diff shows the changed lines you have not yet staged (git diff --staged shows the staged ones), git add stages what goes into the next commit and git commit records it.

When to commit

Commit whenever the app is in a state you would be glad to return to: before asking an AI tool for a large change, after a change you have checked, before updating packages. Small commits with clear messages ("Add CSV export to the orders page") are easier to understand and to undo than one huge commit called "stuff".

Commits are local until pushed

A commit lives on your machine until you push it to a remote such as GitHub or GitLab. A remote copy protects you if your laptop dies, and it is how other people and deploy tools get your work.

Words to know

Repository
the project folder plus its full history
Commit
a saved snapshot with a message
Remote
a copy of the repository on another server
Push
send your commits to the remote

Sources

  1. Pro Git: Recording Changes to the Repository
  2. Git documentation: git-commit

Checked October 17, 2026. Pages on other sites change; if a source no longer says what the lesson says, the source wins.

Lesson check

Two questions. Answer both correctly to pass this lesson. You can try as often as you like.

1Which command shows the lines you changed but have not yet staged?
2When is a good time to commit?