AI Hints
Home›Git & GitHub Tutorial›Quick-Fire Quiz
Git & GitHub · Lesson 140 of 144

Quick-Fire Quiz

Test yourself.

⏱ 2 min read▶ Video at 2:33:31🎓 Free
Watch this lesson in the Git & GitHub courseWatch on YouTube ↗Full Git & GitHub course

Let's test everything you've learned, with quick questions. For each one, pause, pick your answer, then listen to the explanation. Don't worry about getting some wrong. That's how learning sticks.

Quick-Fire Quiz
From the video: Quick-Fire Quiz
  • Quick questions
  • Pause and pick
  • Mistakes help you learn

Question 1

You created a new file. Which command makes Git include it in the next commit? Git commit dash a m, git add, or git push? The answer is git add. Commit dash a only includes files Git already tracks, and push only uploads commits.

Quick check
A new file should go into the next commit. Which command?

Question 2

Which command shows changes you've staged, but not committed yet? Git diff, git diff dash dash staged, or git status? The answer is git diff dash dash staged. Plain diff shows unstaged changes, and status only lists file names.

Quick check
Which shows staged, uncommitted changes line by line?

Question 3

You want to try an idea without touching main. What do you do? Commit on main and revert later, create a branch with git switch dash c, or clone the repository again? The answer is create a branch. Branches are cheap, and made exactly for this.

Quick check
Try an idea without touching main?

Question 4

Your push is rejected, because the remote contains work you don't have. What's the right fix? Git push dash dash force, git pull then git push, or delete your commit? The answer is pull, then push. Force would delete your teammate's work.

Quick check
Push rejected: 'remote contains work you do not have'. Fix?

Question 5

A file is listed in dot git ignore, but Git still tracks it. Why? Because the ignore file is broken, because the file was already committed before being ignored, or because ignore only works on GitHub? The answer is, it was committed first. Use git r m dash dash cached to stop tracking it.

Quick check
A file in .gitignore is still tracked. Why?

Summary

Five down. Next, round two, with harder questions.

Key takeaways
  • git add for new files
  • diff --staged
  • Pull, then push
Next up: Quick-Fire Quiz: Round Two — harder questions