1

I was reading through this Git Commit Message Conventions document for a project and discovered what I think to be an improper recommendation to use imperative mood.

First, if you're not familiar with Git, here is a little background. Git is source code management software. When you make a change to your code you "commit" the code to the repository. When you "commit" you need to include a message explaining what the "commit" does or changed.

The document, based on this blog post, says to use imperative, but the example does not seem to be imperative. Instead it just seems like a fragment. In fact the blog post says that the message should describe what will happen if the commit (the set of changes) is applied.

It seems weird for it to be imperative:

[You,] rename the iVars to remove the common prefix.

[Let it] rename the iVars to remove the common prefix.

When this really what it should mean:

[This commit will] rename the iVars to remove the common prefix.

[Applying this commit will] rename the iVars to remove the common prefix.

I have two questions:

  1. Am I correct that imperative is the wrong grammatical construct?

  2. Is there a grammatical name for dropping the subject, as in the latter example?

  • Please edit this to separate out the quotes with the > symbol. Otherwise it's very hard to understand. – curiousdannii Apr 15 '15 at 1:12
  • You might be interested in the topic of conversational deletion, where the beginning part of a sentence might be omitted when it can be considered to be understood. – F.E. Apr 15 '15 at 6:47
1

I think this is indeed the "imperative", and I see this use of it as analogous to the way that math formulas or arithmetic procedures are commonly expressed; each line of code in a process is equivalent to one step of an arithmetic problem. Things like "Add 1 and 2. (Then) Divide by 3" or "Put down 6 and carry 2." The imperative here isn't addressed to any particular person, but describing the steps that have to be taken to achieve a desired result. In this case, the steps are to be carried out by a mechanical "computer" rather than a human one, but the convention remains the same. In fact, programming is often conceptualized as giving orders to the computer; hence the name of the "imperative programming" paradigm.

1

I don't think OP's "programmer's comment" message format is really "imperative" in that sense. It's the same basic mode as the kind of inline comments coders sometimes write...

myvalue = myvalue + 1; // increment x
errorcode=validate(x); // check x is valid
etc., etc.

...where obviously the bolded comments aren't imperative instructions to a future code maintenance worker. Effectively, they simply restate what the preceding code does.

If you have to imagine a syntactic "subject" for my examples, I suppose you could say it's the machine that will eventually execute the code (or the compiler producing machine-code from the human-readable version above). But that's all a bit vague.

It's easier to simply imagine an elided What this [line of code] does is... before the comment - or in OP's context, What this amendment does is...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.