Commits: snapshots with a reason
Record the staged changes with a message a future reader — usually you — can understand.
Lesson 4 of 9 in Git8 min1 exercise
A commit stores whatever is staged. The message is not decoration: it is the only explanation your future self gets when reading git log six months from now.
git add .
git commit -m "Add first lesson"
# [main 1a2b3c4] Add first lesson
# 1 file changed, 12 insertions(+)
git log --oneline -1
# 1a2b3c4 Add first lessonWrite the subject in the imperative, as if finishing the sentence *"This commit will…"*: Add first lesson, not Added or adding. Keep it under about 50 characters, then leave a blank line and explain why in the body if it needs context.
Exercises
Checked in your browser · hints and solutions included
01
Exercise
Commit with a message
Your changes are already staged. Commit them with the exact message Add first lesson.
terminal
↵