0
0
Gitdevops~20 mins

Viewing commit history with git log - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Git Log Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Understanding git log output with --oneline
What is the output of the command git log --oneline in a repository with three commits?
AOnly the commit hashes without messages
BA detailed list of commits with author, date, and full commit message
CA list of commit hashes and their first line messages, one per line
DAn error message saying the option is invalid
Attempts:
2 left
💡 Hint
The --oneline option shortens the output to one line per commit.
💻 Command Output
intermediate
2:00remaining
Effect of --graph option in git log
What does the git log --graph command add to the commit history output?
AA list of commits sorted by author name
BA summary of changed files per commit
COnly commits from the current branch
DA visual ASCII graph showing branch and merge history alongside commits
Attempts:
2 left
💡 Hint
Think about how git shows branching and merging visually.
Configuration
advanced
2: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?
Agit log --format="%H %ae"
Bgit log --pretty=format:"%h - %an"
Cgit log --oneline --author
Dgit log --pretty=short
Attempts:
2 left
💡 Hint
Use the --pretty=format: option with placeholders for hash and author name.
Troubleshoot
advanced
2:00remaining
Diagnosing empty git log output
You run git log but see no output. What is the most likely reason?
AThe repository has no commits yet
BThe git log command is deprecated
CYou are not connected to the internet
DYour terminal does not support git commands
Attempts:
2 left
💡 Hint
Think about what git log shows and when it would be empty.
Best Practice
expert
2: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?
Agit log -5 --oneline
Bgit log --since=5
Cgit log -n 5 --pretty=full
Dgit log --limit=5 --short
Attempts:
2 left
💡 Hint
Use the option that limits number of commits and shortens output.