TetSharing

Git & CLI final quiz

One question from each of the 12 chapters. Pick an answer for each, then press Check answers. Each explanation links back to the chapter it comes from, so you know exactly what to reread.

12 questions

1. What does cd .. do?

.. is the parent directory. (Chapter 1: Terminal basics)

2. Which command copies a folder and everything inside it?

The -r flag makes cp copy directories recursively. (Chapter 2: Working with files)

3. Why is uniq usually run after sort?

Sorting groups identical lines together so uniq can collapse them. (Chapter 3: Pipes and redirection)

4. A new file appears in git status as untracked. What does that mean?

Untracked files exist in the folder but have not been added to Git. (Chapter 4: What Git is)

5. You edit app.js after running git add app.js. What happens to the second edit?

Staging copies the file as it was at that moment. (Chapter 5: Staging and commits)

6. What does HEAD~1 refer to?

~1 means one step back from HEAD. (Chapter 6: Viewing history)

7. In a diff, what does a line starting with + mean?

+ marks added lines; - marks removed lines. (Chapter 7: Comparing changes)

8. How does Git mark the current branch in git branch output?

The current branch is prefixed with an asterisk. (Chapter 8: Branches)

9. When does Git do a fast-forward merge?

With nothing new on the receiving side, Git just moves its label forward. (Chapter 9: Merging)

10. After editing a conflicted file into its final form, what marks it as resolved?

Staging the file tells Git the conflict is resolved; then commit. (Chapter 10: Merge conflicts)

11. You staged secrets.txt by mistake. How do you unstage it but keep the file?

--staged only touches the staging area. (Chapter 11: Undoing changes)

12. Which command downloads new remote commits without changing your files?

fetch updates remote-tracking branches only; pull also merges. (Chapter 12: Remotes, push and pull)

← Back to the Git & CLI tutorial