Git Level 1 Test
A swimming instructor doesn't move a child to the deep end because they have attended ten lessons. They ask the child to swim one length on their own, and then they decide. This test is your length of the pool for the first level of the Git course: what Git is, setting it up, the three areas, recording changes, reading history and undoing mistakes. If you pass it, you are ready for branches. If you don't, each answer tells you exactly which lesson to read again.
How the Test Works
- What's in it: 20 multiple-choice questions, then 3 puzzles where you work out what Git prints at the end of a short terminal session.
- Time: 30 minutes, without notes and without running Git. Answer the puzzles on paper first; run them only to check afterwards.
- Pass mark: 16 out of 23. The quiz marks the 20 questions for you. Mark the puzzles yourself, one point each, and add them to your quiz score.
- What it covers: the lessons from "What Is Version Control" to "Git Clean".
Part 1: 20 Questions
Part 2: "What Does Git Print?" Puzzles
Work out what the last command of each session prints, on paper, before you open the solution. Each session starts in a new, empty temporary folder (cd "$(mktemp -d)"), with your name and email address already set. Give yourself one point for each puzzle you get exactly right.
Puzzle 1: Edited After Staging
cd "$(mktemp -d)"
git init --quiet
echo 'Term fee: $12,000' > fees.txt
git add fees.txt
echo 'Late fee: $250' >> fees.txt
git commit --quiet -m "Add the fees"
git status --shortShow solution
cd "$(mktemp -d)"
git init --quiet
echo 'Term fee: $12,000' > fees.txt
git add fees.txt
echo 'Late fee: $250' >> fees.txt
git commit --quiet -m "Add the fees"
git status --short M fees.txtWhy this output?
git add staged the file as it was then, with only the term fee. The late fee line was added afterwards and never staged, so the commit doesn't contain it, and git status shows the file as modified in the working tree ( M, with a space on the left). Revise: Git Add: Staging Changes.
Puzzle 2: An Exception to an Ignore Rule
cd "$(mktemp -d)"
git init --quiet
printf "%s\n" "*.log" "!keep.log" > .gitignore
touch app.log keep.log notes.txt
git status --shortShow solution
cd "$(mktemp -d)"
git init --quiet
printf "%s\n" "*.log" "!keep.log" > .gitignore
touch app.log keep.log notes.txt
git status --short?? .gitignore
?? keep.log
?? notes.txtWhy this output?
*.log ignores every log file, and !keep.log makes an exception for one. So app.log is hidden, while .gitignore, keep.log and notes.txt are listed as untracked (??), in alphabetical order. Revise: Git .gitignore.
Puzzle 3: A Soft Reset
cd "$(mktemp -d)"
git init --quiet
echo 'Term fee: $12,000' > fees.txt
git add fees.txt
git commit --quiet -m "Add the term fee"
echo 'Late fee: $250' >> fees.txt
git commit --quiet -am "Add the late fee"
git reset --soft HEAD~1
git status --shortShow solution
cd "$(mktemp -d)"
git init --quiet
echo 'Term fee: $12,000' > fees.txt
git add fees.txt
git commit --quiet -m "Add the term fee"
echo 'Late fee: $250' >> fees.txt
git commit --quiet -am "Add the late fee"
git reset --soft HEAD~1
git status --shortM fees.txtWhy this output?
--soft moved the branch back one commit but left the staging area as it was, so the late fee change is staged again (M with the letter on the left), ready to be committed differently. With --mixed it would be unstaged ( M), and with --hard it would be gone. Revise: Git Reset: Soft, Mixed and Hard.
What Your Score Means
| Score (out of 23) | What it means | What to do next |
|---|---|---|
| 20 to 23 | You know the basics well | Move on to Git Branch |
| 16 to 19 | A pass, with a few gaps | Read the lessons linked from the questions you missed, then move on |
| Under 16 | Not yet | Reread the lessons behind your wrong answers, do Lab 1 and Lab 6 on Git Labs, and take the test again |
Was this tutorial helpful?