Challenge - 5 Problems
Git Log Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
Understanding git log output with --oneline
What is the output of the command
git log --oneline in a repository with three commits?Attempts:
2 left
💡 Hint
The
--oneline option shortens the output to one line per commit.✗ Incorrect
The git log --oneline command shows each commit as a short hash followed by the first line of the commit message, making it easy to scan commit history quickly.
💻 Command Output
intermediate2:00remaining
Effect of --graph option in git log
What does the
git log --graph command add to the commit history output?Attempts:
2 left
💡 Hint
Think about how git shows branching and merging visually.
✗ Incorrect
The --graph option adds an ASCII art graph on the left side of the log output to visualize branches and merges.
❓ Configuration
advanced2:00remaining
Customizing git log output with pretty format
Which
git log command produces output showing only the commit hash and author name separated by a dash?Attempts:
2 left
💡 Hint
Use the
--pretty=format: option with placeholders for hash and author name.✗ Incorrect
The --pretty=format:"%h - %an" option formats each commit line to show the short hash (%h), a dash, and the author name (%an).
❓ Troubleshoot
advanced2:00remaining
Diagnosing empty git log output
You run
git log but see no output. What is the most likely reason?Attempts:
2 left
💡 Hint
Think about what git log shows and when it would be empty.
✗ Incorrect
If there are no commits in the repository, git log will show no output because there is no history to display.
✅ Best Practice
expert2:00remaining
Efficiently viewing last 5 commits with concise info
Which command best shows the last 5 commits with short hashes and commit messages in a compact form?
Attempts:
2 left
💡 Hint
Use the option that limits number of commits and shortens output.
✗ Incorrect
git log -5 --oneline shows the last 5 commits with short hashes and one-line messages, which is concise and efficient.