Interview Q&A / Git & GitHub

BeginnerQuick answer1 min readUpdated 3 Oct 2026

Why are commit messages written in the imperative mood?

SHORT ANSWER

Git's own messages, like 'Merge branch' or 'Revert commit', are imperative, and the convention completes the sentence 'If applied, this commit will...'. It keeps the log consistent and short.

Explain it simply

A useful test: finish the sentence 'If applied, this commit will ______'. 'Fix login redirect' fits; 'Fixed login redirect' and 'Fixes login redirect' do not.

The reasoning is that a commit is an instruction applied to the code, similar to a recipe step ('Add salt'). It matches what Git generates itself and what git revert writes. It is a style rule, not a technical one, and teams may choose otherwise, but consistency matters more than which rule you pick.

Example

text
Good:  Add dark mode toggle
Bad:   Added dark mode toggle
Bad:   Adds dark mode toggle
Test:  If applied, this commit will add dark mode toggle

What to say in the interview

"The convention is the imperative, such as Add or Fix, so the subject completes the sentence 'If applied, this commit will...'. It matches messages Git generates itself, and what matters most is that the team stays consistent."

#git#commit-message#style

Related questions

Practise more Git & GitHub questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Git & GitHub quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.