AlgoMaster Logo

Viewing History - Quiz

Last Updated: January 3, 2026

Viewing History Exercises

30 quizzes

1
Code Completion

Show the changes and metadata for the most recent commit on the current branch

shell
1
git

Click an option to fill the blank:

2
Code Completion

View a one-line summary for each commit in the current branch history

shell
1
git log --pretty=

Click an option to fill the blank:

3
Code Completion

Compare staged changes against the last commit before committing

shell
1
git diff

Click an option to fill the blank:

4
Code Completion

See who last modified each line of a file to investigate a behavior change

shell
1
git src/auth.js

Click an option to fill the blank:

5
Code Completion

Start a binary search to find the commit that introduced a failing test

shell
1
git start

Click an option to fill the blank:

6
Multiple Choice

Which command is best suited to inspect the detailed changes and metadata of a single commit?

7
Multiple Choice

You want to see only commits made by "Alice" in the last week. Which command is most appropriate?

8
Multiple Choice

Which command is best for finding all occurrences of the string "token" in the current version of tracked files?

9
Multiple Choice

During a bisect session, how do you tell Git that the currently checked-out commit does NOT have the bug?

10
Multiple Choice

You see a suspicious function in app/router.js and want to know who last changed each line. Which is the most direct command?

11
Sequencing

Order the steps to inspect which commit introduced a specific line in src/login.js and then review that commit's changes.

Drag and drop to reorder, or use the arrows.

12
Sequencing

Order the steps to use git bisect to find the commit that introduced a failing test.

Drag and drop to reorder, or use the arrows.

13
Sequencing

Order the steps to compare your staged changes against a specific previous commit.

Drag and drop to reorder, or use the arrows.

14
Sequencing

Order the steps to search commit history for bug-fix messages and then inspect one of the matching commits.

Drag and drop to reorder, or use the arrows.

15
Output Prediction

You are currently on branch "feature/search-history". What will this command output?

1git branch --show-current
16
Output Prediction

HEAD currently points to commit abc1234. What will this command output?

1git rev-parse --short HEAD
17
Output Prediction

You just ran git log --pretty=oneline and saw the latest commit hash is 9f8e7d6. What will this command output?

1git show -s --format=%H
18
Output Prediction

In a bisect session, Git just determined commit 1122aabb is the first bad commit. What will this command output?

1git rev-parse --short HEAD
19
Bug Spotting

Identify the incorrect command in this attempt to inspect a specific commit and its diff.

Click on the line(s) that contain the bug.

shell
1
git log --oneline
2
git show abc1234 src/app.js
3
git diff abc1234..def5678 src/app.js
4
git blame src/app.js
20
Bug Spotting

Find the incorrect command in this workflow to start and drive a bisect session.

Click on the line(s) that contain the bug.

shell
1
git bisect start
2
git bisect bad
3
git bisect good main
4
git bisect ok
5
git bisect reset
21
Bug Spotting

Spot the mistake in this attempt to search commit messages for fixes and show one commit.

Click on the line(s) that contain the bug.

shell
1
git log --grep fix
2
commit_hash=$(git log --grep fix -n 1 --format=%H)
3
git show $commit_hash src/fix.js
22
Matching

Match each Git history command to its primary purpose.

Click an item on the left, then click its match on the right. Click a matched item to unmatch.

23
Matching

Match the Git history search method to what it searches.

Click an item on the left, then click its match on the right. Click a matched item to unmatch.

24
Matching

Match the git bisect command to its role in the bisect workflow.

Click an item on the left, then click its match on the right. Click a matched item to unmatch.

25
Fill in the Blanks

Complete the commands to compare your working directory and staged changes against HEAD.

shell
1
git diff
2
git diff
3
git diff

Click an option to fill blank 1:

26
Fill in the Blanks

Complete the commands to search for commits by author and then show the latest one.

shell
1
git log --author= --pretty=oneline
2
LATEST_COMMIT=$(git log --author= -n 1 --format=%H)
3
git show

Click an option to fill blank 1:

27
Fill in the Blanks

Complete the commands to narrow git blame to a specific line range while ignoring whitespace changes.

shell
1
git blame src/config.js

Click an option to fill blank 1:

28
Hotspot Selection

Select the line that shows the commit hash for the currently displayed commit.

Click on the line to select.

shell
1
commit 9a3c6723ab6b9e4e2e9c9a5e4b5f1e321e5b926 (HEAD -> main)
2
Author: Jane Doe <jane@example.com>
3
Date:   Mon Oct 18 14:23:45 2023 -0400
4
 
5
    Fix bug in user authentication
29
Hotspot Selection

Select the line that indicates which lines were changed in this diff hunk.

Click on the line to select.

shell
1
@@ -10,5 +10,6 @@ function authenticate(user) {
2
   if (!user) {
3
-    throw new Error("No user");
4
+    throw new Error("User is required");
5
   }
6
+  return true;
7
 }
30
Hotspot Selection

Select the line that shows who last modified the shown line of code.

Click on the line to select.

shell
1
3f6a9b1a (Alice Smith 2025-11-25 14:12:03 +0530 10) function validateEmail(email) {
2
3f6a9b1a (Alice Smith 2025-11-25 14:12:03 +0530 11)   const pattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
3
8c7d5e2f (Bob Lee    2025-11-26 09:45:18 +0530 12)   return pattern.test(email);