← VCE Software Development U4O1

Saving a snapshot with git add and git commit

Records a snapshot of the files you staged with git add, saving it in the repository history with a short message that explains what changed.

Understanding Saving a snapshot with git add and git commit in VCE Software Development U4O1

What it does: The dot means the current folder, so git add . stages all changes ready for a commit. This message is short and specific, so teammates can tell what the snapshot changed without reading the code. git add moves changes into the staging area. git commit then records whatever is staged. git commit -m saves the staged snapshot in the repository history with a message. git add only stages files. The -m flag needs its hyphen. It tells git the message follows, in quotes, on the same line. Use a clear message that describes the change, such as git commit -m "Add input validation to age field".

Common mistakes: The command is misspelled. Staging a file uses git add, so the line should be git add main.py. The -m flag is missing. Without it git does not read the text as a message. It should be git commit -m "Fix tax bug".

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 82–114) and word search (Modules 3–114).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which command stages a file called main.py so it is ready for the next snapshot?
git add main.pygit commit main.py
Matches
git commit -m Add login check
↓
The message is not wrapped in quotes, so git reads Add, login and check as separate arguments instead of one message.
Applying
Meanings
Term
git commit -m "message"
Meaning
Records a snapshot of the files you staged with git add, saving it in the repository history with a short message that explains what changed.
Practice
git add main.py
Testing
Gaps
git main.py
Check Answer
Spots
1git status
2git ad main.py

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Cheetah' badge — Savannah Sprinter, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which command stages a file called main.py so it is ready for the next snapshot?
A. git commit main.py
B. git add main.py ✓
git add moves changes into the staging area. git commit then records whatever is staged.
2. Which command records a snapshot of your staged files with a message?
A. git commit -m "Add login check" ✓
B. git add -m "Add login check"
git commit -m saves the staged snapshot in the repository history with a message. git add only stages files.
3. What is the correct order to save your work as a snapshot?
A. git add first, then git commit -m ✓
B. git commit -m first, then git add
You must stage changes with git add before committing. If you commit first, there is nothing new staged to record.
4. Which commit message is clearer for future developers?
A. git commit -m "stuff"
B. git commit -m "Fix divide by zero in average" ✓
A clear message says what changed and why. Vague messages like 'stuff' make the history hard to understand.
5. True or false: git add saves a permanent snapshot in the repository history.
A. False - git add only stages changes ✓
B. True - git add records the snapshot
git add only stages changes. The snapshot is saved in the history when you run git commit.

Match the Pairs

git add main.py → Stages the changes in main.py so they are included in the next snapshot
git commit -m "Add login check" → Saves a snapshot of the staged files in the repository history with a message
Stage every changed file in the folder so all of them go into the next snapshot → git add .
A clear commit message says what changed, written in a short present-tense phrase → git commit -m "Fix score calculation bug"
git commit -m Add login check → The message is not wrapped in quotes, so git reads Add, login and check as separate arguments instead of one message.
git commit -m "stuff" → The message is vague. It does not explain what changed, so the project history is hard to understand later.

Key Term

git commit -m "message"
Records a snapshot of the files you staged with git add, saving it in the repository history with a short message that explains what changed.

Fill in the Blanks

1. git add main.py
Hint: Type the git subcommand that stages a changed file ready for the next snapshot.
2. git add main.py git commit -m "Add login check"
Hint: Type the git subcommand that records the staged files as a snapshot.
3. git commit -m "Fix score bug"
Hint: Type the flag that lets you write the commit message on the same line.
4. git add . git commit -m "Update scoring"
Hint: Type the single character that stages every changed file in the current folder.
5. git add report.py git commit -m "Add header"
Hint: Type the name of the version control program that every one of these commands starts with.

Spot the Error

Question 1
A git status
B git ad main.py
C git commit -m "Add login form"
Line B — The command is misspelled. Staging a file uses git add, so the line should be git add main.py.
Question 2
A git add main.py
B git status
C git commit "Fix tax bug"
Line C — The -m flag is missing. Without it git does not read the text as a message. It should be git commit -m "Fix tax bug".
Question 3
A git status
B git add report.txt
C git commit -m Add summary
Line C — A message with spaces must be wrapped in quotes. Without them git only takes Add as the message. It should be git commit -m "Add summary".
Question 4
A git status
B git commit data.csv
C git commit -m "Add scores"
Line B — Files are staged with git add, not git commit. Line 2 should be git add data.csv. The commit then records the staged snapshot with a message.
Question 5
A git status
B git add app.py
C git add notes.txt
D git commit -m
Line D — The -m flag needs a message after it. It should be git commit -m "Update app" so the snapshot is saved with a short description.

Student with a class code? Join your class →