Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (19.4k points)
edited by

I read once that git commit messages should be in the imperative present tense, e.g. "Add tests for x". I always find myself using the past tense, e.g. "Added tests for x" though, which feels a lot more natural to me.

Here's a recent John Resig commit showing the two in one message:

Tweak some more jQuery set results in the manipulation tests. Also fixed the order of the expected test results.

Does it matter? Which should I use?

1 Answer

0 votes
by (27.5k points)

Describe your changes in imperative mood, e.g. "make ABC do something" instead of "[This patch] makes ABC do something" or "[I] changed ABC to do something", as if you are giving orders to the codebase to change its behavior.

So you will find a lot of Git commit messages written in this style. If you're working on a team or on open source software, it is helpful if everyone sticks to that style for consistency. Even if you're working on a private project, and you're the only one who will ever see your git history, it's helpful to use the imperative mood because it establishes good habits that will be appreciated when you're working with others.      

Browse Categories