All Git quizzes
Intermediate30 questions40 minutes

Git Intermediate Quiz

Branching, merging, staging and remotes — the commands you run every day, and what they actually do to your history.

Start the quiz

Sample questions from this quiz

A preview of the style and depth. Try each one, then reveal the answer — or skip straight to the timed quiz.

1. You have edited three tracked files. What does this stage?

git add .
  • Nothing until you commit
  • Only modified files, not new ones
  • Only files in the repository root
  • All three, plus any new untracked files in the current directory
Show answer

Answer: All three, plus any new untracked files in the current directory. `git add .` stages everything under the current directory, including untracked files — which is how secrets and build output end up committed. `git status` first, and a real `.gitignore`, are what keep it safe.

2. What is the difference between these two?

git diff
git diff --staged
  • The second compares against the remote
  • They are identical
  • The first shows all changes; the second only new files
  • The first shows unstaged changes; the second shows what is staged
Show answer

Answer: The first shows unstaged changes; the second shows what is staged. `git diff` compares the working tree against the index, so it shows what you have *not* staged. `--staged` (or `--cached`) compares the index against HEAD — what the next commit will contain. Reviewing the staged diff before committing catches a lot of mistakes.

3. You meant to create a branch and switch to it, but you are still on main. Which line is wrong?

1  git branch feature/login
2  git status
3  # On branch main
  • Line 1 — you must commit first
  • Line 1 — the branch name cannot contain a slash
  • Line 2 — status does not show the branch
  • Line 1 — git branch creates the branch but does not switch to it
Show answer

Answer: Line 1 — git branch creates the branch but does not switch to it. `git branch <name>` only creates the pointer. Use `git switch -c <name>` (or the older `git checkout -b`) to create and move in one step. Slashes in branch names are fine and are the usual convention for grouping.

Frequently asked questions

How many questions are in this Git quiz?+

30 questions, with a 40-minute time limit. Every question includes a written explanation of the correct answer.

Is this Git quiz free?+

Yes. Every quiz on CodexQuizz is free and needs no account. You only enter a name if you choose to post your score to the leaderboard.

What level is the intermediate quiz aimed at?+

Branching, merging, staging and remotes — the commands you run every day, and what they actually do to your history.

Can I use this to prepare for a Git interview?+

Yes. The questions cover the topics that come up in Git technical screens, and the explanations are written so that a wrong answer still teaches you the underlying concept.

Ready to test your Git?

30 questions, 40 minutes. Free, no sign-up.

Start now