Should I use past tense or present tense when writing check-in/commit comment? [duplicate]

This question is quite specific but I am not sure which verb tense I should use when committing/checking in code.

If I fix a bug and checking in the code, should I write:

  1. Fixes bug on feature A
  2. Fixed bug on feature A

I always use past tense because the bug was fixed before I check in but it looks a bit strange when I look at file history.

Should I use one over the other and why?


Both are appropriate, it actually depends on the way you want the user to read it.

1. Fixes bug on feature A - This is more universal, this will let people know that the check in has feature A bug fixed. So, this is the tone of the check-in and not that of the user.

2. Fixed bug on feature A - This has more to do with the tone of the user who is checking in.

So, in case you are working on an open source project with lots of people reading about the check-in, and they like to know about the check-in more than the user who did it, try to go with option 1, else, go with option 2


The following convention for commit messages works well for me:

  • Describing what changes were made to the code in the commit: Past tense.
  • Describing what the code was doing before the change: Past continuous.
  • Describing what the code does, especially after the change: Present tense.

Encoding the distinction between the three kinds of actions using the tense of the verb keeps the messages compact.

Example:

Fixed bug 178508 (Wrong permissions on keydir)

Exclude the base directory from rsync -a, so that the permissions of the destination directory remain unchanged. Previously, rsync -a was clobbering / would clobber the destination directory's permissions.