5 ms·
I find it unnatural to write commit messages in the present tense. To me, it seems like commit messages are a log of what work has been done, which would natur
by davidcuddeback 16y ago
I find it unnatural to write commit messages in the present tense. To me, it seems like commit messages are a log of what work has been done, which would naturally be described in past tense. Nonetheless, I do write my commit logs in present tense for the sake of consistency.
Does anyone have a good explanation of why commit messages should be in the present tense? (Beyond what the article says: "This convention matches up with commit messages generated by commands like git merge and git revert.") Why do commands like git merge and git revert generate commit messages in the present tense? The best explanation that I can think of is an analogy to literature: literary analysis is written in the present tense, because any time you open a book, the story is happening now, in the present tense. I don't quite buy that, but it's the best explanation I've come up with.
- tedunangst 16y agoA patch that changes X to Y will always change X to Y. Maybe you applied the patch in the past, but the patch itself will never stop changing X to Y.
- aerique 16y agoYou win the aerique Daily HN award for the best and most concise answer. From now on I will write my commit messages in the present tense.
- shasta 16y agoMy guess is that it's because it was designed from the point of view of someone looking at patches to be added, rather than from the point of view of someone who writes a bunch of code. Imagine you're looking at a patch and asking what it does. It's more natural to describe that this patch will "add support for feature X" than "added support for feature X".
- kleiba 16y agoWhen the message is supposed to describe what the patch does, shouldn't it then be written in the 3rd person singular: "adds support for feature X"?
- sid0 16y agoI write my commit messages in the present tense, but I have no idea why anyone would care about it in the slightest.
- random42 16y agoI also find writing commit messages in present tense unnatural. Possible Explanation for present tense commit messages - Commit messages are treated as Instruction(s) to a third person, as if she is applying the patches one-by-one. "Implement Feature A" Now, "Fix the bug in the previously developed Feature A" etc.
- jcsalterego 16y agoClearly there is an ordering between commits -- parents and children -- but I don't see commits as having much temporal value. Branches and commits can be merged and rebased left and right, and it only seems to follow that commits have an intrinsic state that's (not to be cliché) timeless. Patches and commits, regardless of when they're written, provide changes and accomplish X Y and Z -- it's only when one runs the code that time comes into play. Semantics, I suppose, or I have had too much coffee this morning.
- tomstuart 16y agoCommits are like actions. For example, think about the "fast-forwarding", "rewinding" and "replaying" that Git does. When you rebase, Git rewinds your divergent commits, fast-forwards the branch, and then replays your commits again. What happens when it replays those commits? Fix login bug. Update copyright year. Ignore log directory. Done!
- roxstar 16y agoI don't know it seems so weird to see it like that, fix login bug seems more like a todo than an action. I could understand if it were in this format: Fixes login bug. Updates copyright year. Ignores log directory. Those seem so much more like actions than the other.
- deleted 16y ago[deleted]
- 6ren 16y agoIs "Fix bug" actually in the present tense? I would have thought present tense would be "Fixing bug", and that Fix bug is imperative. That makes more sense (to me) for the example of rebasing - the applied diffs become a list of commands of what to do: Do this! Do that!
- mileszs 16y agoI hesitate to be this guy, but: If I'm not mistaken, strictly speaking, the mood/mode is imperative, but the tense is present. Imperative is not a tense. In English, there are only two true tenses: past and present. To disclose fully, I had only a notion of this before resorting to Wikipedia to confirm and provide some clarity. http://en.wikipedia.org/wiki/Grammatical_tense http://en.wikipedia.org/wiki/Grammatical_tense and http://en.wikipedia.org/wiki/Grammatical_mood http://en.wikipedia.org/wiki/Grammatical_mood
- kleiba 16y agoThey're both present tense: - "Fix bug" is simple present - "Fixing bug" is present progressive
- munificent 16y agoI used to find it unnatural too. Recently, I changed my working habits so that I keep a running todo list of things I'm working on. When I complete a task, the todo becomes the commit message, and I leave it in present tense. Other reasons to prefer it: * It's generally shorter than the alternatives: "Implement" versus "Will implement", "implements", or "implemented". * I think it's actually more accurate to say that commit messages should be in the imperative mood, not the present tense. The message is basically telling some unspecified agent to do something "Fix this bug." That lines up with the imperative form we use to write a lot of code.
- sophacles 16y agoThe idea i get is that the log is not a history of your actions, but a description of what that particular revision does. So if i take the diff and apply it to my tree, the log tells me what it will do.