Git Commit History Quiz

Git
0 Passed
0% acceptance

Unlock the secrets of your project's past. Learn to navigate the commit log, search for specific changes, and visualize the history graph like a pro.

25 Questions
~50 minutes
1

Question 1

Which command displays the commit history of the current branch in reverse chronological order?

A
git history
B
git log
C
git show
D
git commits
2

Question 2

Every commit in Git is identified by a unique string of characters (e.g., `a1b2c3d...`). What is this identifier called?

A
Commit ID
B
SHA-1 Hash
C
Version Number
D
Timestamp
3

Question 3

You want to see a condensed version of the log, showing only the commit hash and the subject line for each commit. Which command achieves this?

A
git log --short
B
git log --oneline
C
git log --summary
D
git log --brief
4

Question 4

You are looking for a commit where you added a function named `calculateTotal`. Which command searches the *content* of the changes (the diffs) for this string?

A
git log --grep='calculateTotal'
B
git log -S 'calculateTotal'
C
git search 'calculateTotal'
D
git find 'calculateTotal'
5

Question 5

You want to search for a commit based on the text in its *commit message* (e.g., finding a commit that mentions 'bug fix'). Which command does this?

A
git log --message='bug fix'
B
git log --grep='bug fix'
C
git log -S 'bug fix'
D
git log --search='bug fix'
6

Question 6

Which command displays the commit history as a text-based graph, showing branching and merging lines?

A
git log --graph
B
git log --tree
C
git log --visual
D
git show-branch
7

Question 7

You want to see the details of a specific commit (the diff, author, message) identified by the hash `a1b2c3d`. Which command do you use?

A
git log a1b2c3d
B
git show a1b2c3d
C
git view a1b2c3d
D
git checkout a1b2c3d
8

Question 8

You want to see the last 3 commits only. Which command limits the output?

A
git log --limit 3
B
git log -n 3
C
git log --last 3
D
git log --count 3
9

Question 9

What does the `--stat` option do in `git log --stat`?

A
It shows the status of the working directory.
B
It shows a summary of statistics for each commit (files changed, insertions, deletions).
C
It shows the commit hash in static format.
D
It shows the author's statistics.
10

Question 10

You want to see the history of a *specific file* named `app.js` (including renames). Which command is best?

A
git log app.js
B
git log --follow app.js
C
git history app.js
D
git show app.js
11

Question 11

In the output of `git log --oneline --graph --all`, you see asterisks `*` and lines `| / `. What do the asterisks represent?

A
Merge conflicts.
B
Individual commits.
C
Tags.
D
Active branches.
12

Question 12

You want to view commits that were created *after* a specific date, e.g., Jan 1st, 2023. Which flag do you use?

A
git log --since='2023-01-01'
B
git log --after-date='2023-01-01'
C
git log --from='2023-01-01'
D
git log --start='2023-01-01'
13

Question 13

What does `git log -p` display?

A
It shows the patch (diff) introduced by each commit.
B
It shows only the parent commits.
C
It shows the log in plain text format.
D
It pauses the output (pagination).
14

Question 14

You want to see only the commits authored by 'John Doe'. Which command filters the log this way?

A
git log --user='John Doe'
B
git log --author='John Doe'
C
git log --by='John Doe'
D
git log --who='John Doe'
15

Question 15

What is the difference between `git log` and `git reflog`?

A
They are the same.
B
`git log` shows the public commit history; `git reflog` shows the local history of HEAD movements (including resets and amended commits).
C
`git reflog` is for remote repositories only.
D
`git log` shows tags, `git reflog` shows branches.
16

Question 16

You want to format the log output to show 'Hash - Author - Message'. Which command allows you to define this custom format?

A
git log --format='%h - %an - %s'
B
git log --style='custom'
C
git log --pretty=custom
D
git log --layout='%h %a %m'
17

Question 17

Which command shows the history of all branches, not just the current one?

A
git log --all
B
git log --branches
C
git log --everything
D
git log --full
18

Question 18

You see a commit hash `e83c5163316f89bfbde7d9ab23ca2e25604af290`. Can you use just the first few characters (e.g., `e83c516`) to reference it?

A
No, you must use the full 40 characters.
B
Yes, as long as the abbreviation is unique within the repository.
C
Yes, but only if you configure `core.abbrev`.
D
No, that is unsafe.
19

Question 19

What does `git log master..feature` show?

A
All commits in both branches.
B
Commits that are in `feature` but NOT in `master`.
C
Commits that are in `master` but NOT in `feature`.
D
Commits that are common to both.
20

Question 20

You want to see which files changed in each commit, but not the diffs themselves. Which flag is more concise than `--stat`?

A
git log --name-only
B
git log --files
C
git log --list
D
git log --toc
21

Question 21

How do you view the commit history of a function `myFunction` in `file.js`, specifically looking for when the function definition itself changed?

A
git log -L :myFunction:file.js
B
git log --function myFunction file.js
C
git trace myFunction file.js
D
git blame myFunction file.js
22

Question 22

What does the `HEAD` pointer in `git log` output represent?

A
The first commit of the repo.
B
The current checked-out commit/branch.
C
The remote server.
D
The last tag.
23

Question 23

You want to see commits that modified `css/style.css` AND `index.html` in the same commit. How do you search for this?

A
git log css/style.css index.html
B
git log --and css/style.css index.html
C
git log --files css/style.css index.html
D
You cannot do this.
24

Question 24

Which command shows the log with relative dates (e.g., '2 hours ago') instead of full timestamps?

A
git log --date=relative
B
git log --time=relative
C
git log --rel
D
This is the default behavior.
25

Question 25

You want to verify the GPG signature of signed commits in the log. Which flag enables this?

A
git log --show-signature
B
git log --verify
C
git log --gpg
D
git log --secure