0
0
Gitdevops~5 mins

Writing good commit messages in Git - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
Why is it important to write good commit messages?
Good commit messages help your team understand what changes were made and why. They make it easier to track history, find bugs, and collaborate effectively.
Click to reveal answer
beginner
What are the three main parts of a good commit message?
A good commit message has: 1) A short summary (about 50 characters), 2) A blank line, 3) A detailed explanation if needed (wrapped at 72 characters).
Click to reveal answer
beginner
What tense should you use in the commit message summary?
Use the present tense, like "Fix bug" or "Add feature", because the commit describes what the change does now.
Click to reveal answer
beginner
Example of a good commit message summary?
Fix login error when password is empty
Click to reveal answer
beginner
What should you avoid in commit messages?
Avoid vague messages like "fix" or "update" without details. Also avoid very long summaries or no explanation when the change is complex.
Click to reveal answer
What is the recommended maximum length for the commit message summary line?
A72 characters
B50 characters
C100 characters
D120 characters
Which tense is best to use in commit message summaries?
APast tense (e.g., Fixed bug)
BFuture tense (e.g., Will fix bug)
CAny tense is fine
DPresent tense (e.g., Fix bug)
What should you do after the summary line in a commit message?
AAdd a blank line
BStart writing the detailed explanation immediately
CAdd a list of changed files
DWrite the author name
Why avoid vague commit messages like "fix" or "update"?
AThey don't explain what was fixed or updated
BThey are too short
CThey are not allowed by git
DThey cause merge conflicts
How should long explanations in commit messages be formatted?
AOne long paragraph without breaks
BIn uppercase letters
CWrapped at 72 characters per line
DIn bullet points only
Describe the structure and style of a good commit message.
Think about how to make your message clear and easy to read.
You got /5 concepts.
    Explain why vague commit messages are problematic and how to improve them.
    Imagine your teammate reading your commit weeks later.
    You got /4 concepts.