0
0
Gitdevops~20 mins

Writing good commit messages in Git - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Commit Message Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Why use a short summary line in commit messages?

What is the main reason to keep the first line of a commit message short (around 50 characters)?

ATo include detailed explanations in the summary
BTo make the commit message harder to read
CTo ensure the summary fits well in logs and tools without wrapping
DTo avoid writing a detailed description later
Attempts:
2 left
💡 Hint

Think about how commit messages appear in common git tools and logs.

💻 Command Output
intermediate
1:30remaining
Output of git log with short commit messages

Given these two commits with short summary lines, what will git log --oneline show?

Git
commit 1a2b3c4
Author: Alice
Date: Today

Fix login bug

commit 5d6e7f8
Author: Bob
Date: Yesterday

Add user profile page
A
Fix login bug
Add user profile page
B
1a2b3c4 Fix login bug
5d6e7f8 Add user profile page
C
commit 1a2b3c4 Fix login bug
commit 5d6e7f8 Add user profile page
D
1a2b3c4
Fix login bug
5d6e7f8
Add user profile page
Attempts:
2 left
💡 Hint

Look at the format of git log --oneline output: it shows commit hash and summary.

🔀 Workflow
advanced
2:00remaining
Proper commit message structure

Which option shows the best structure for a detailed commit message?

A
Fix bug in login

This fixes the issue where users could not log in due to a missing token check.
BFix bug in login This fixes the issue where users could not log in due to a missing token check.
C
Fix bug in login
This fixes the issue where users could not log in due to a missing token check.
D
Fix bug in login


This fixes the issue where users could not log in due to a missing token check.
Attempts:
2 left
💡 Hint

Think about spacing between summary and description for readability.

Troubleshoot
advanced
1:30remaining
Identifying a poor commit message

Which commit message is least helpful for understanding the change?

AMiscellaneous fixes and improvements
BUpdate README with installation steps
CFix issue #123 by correcting token validation
DAdd unit tests for user authentication
Attempts:
2 left
💡 Hint

Look for vague or unclear messages.

Best Practice
expert
2:30remaining
Choosing the best commit message for a feature addition

You added a new feature to export user data as CSV. Which commit message best follows good commit message practices?

AFeature: CSV export for users
B
Added CSV export

Users can now export data.
C
CSV export

Export user data as CSV.
D
Add CSV export feature for user data

This feature allows users to export their data in CSV format for easier analysis and sharing.
Attempts:
2 left
💡 Hint

Look for clarity, completeness, and proper structure.