Lesson 04
Commits
A commit saves the staged version of your files as a checkpoint on your current local branch.
Visual Explanation
Ready to run git commit -m "Add navigation".
Keep These Ideas
- Staged snapshot
- The commit records the staged snapshot; unstaged changes are excluded.
- Commit
- A saved checkpoint on the current local branch. It is not pushed automatically.
- Message
- A short explanation of why this checkpoint matters.
The Real Command
Terminal
git commit -m "Add navigation"git commit saves the staged snapshot on the current local branch. In this example, that branch is feature/login. The -m flag attaches a short message.
Command Details
git commit --dry-run--dry-run previews the commit. It shows what would be included without saving anything.
Example Output
On branch feature/login
Changes to be committed:
modified: app.jsgit commit --amend --no-edit--amend replaces the latest local commit. --no-edit keeps its message. Avoid amending a commit teammates already use.
Knowledge Check
Save a Clear Checkpoint
Turn staged work into a focused checkpoint with a useful message.
Question 1 of 5
- Question 1: current
- Question 2: not started
- Question 3: not started
- Question 4: not started
- Question 5: not started