views:

108

answers:

4

I read once that git commit messages should be in the imperative present text, 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?

A: 

It is up to you. Just use the commit message as you wish. But it is easier if you are not switching between times and languages.

And if you develop in a team - it should be discussed and set fixed.

Andreas Rehm
A: 

I think you are free to use either of the tenses. I even use Present Continuous sometimes Adding feature X.

Omar
+2  A: 

does it matter? people are generally smart enough to interpret messages correctly, if they aren't you probably shouldn't let them access your repository anyway!

clocKwize
+2  A: 

The preference for present-tense, imperative-style commit messages comes from Git itself. From Documentation/SubmittingPatches in the Git repo:

the body should provide a meaningful commit message, which:
- uses the imperative, present tense: "change", not "changed" or "changes".

So you'll see a lot of Git commit messages written in that style. But it doesn't matter -- you can do whatever you prefer.

mipadi
I think this is an excellent choice. Think about what a commit is, in diff form: a set of instructions for how to go from a previous state to a new state. Just as the diff says "add this line here, remove this line here", the commit message says in qualitative terms "make this change". (Yes, git does store the commit simply as a tree with metadata, but to a human, the important part of a commit is the diff.)
Jefromi