Pergunta

I've read all kinds of Git tutorials, including the official one, and they all seem to tell me it's good convention and practice to write Git commit notes in the present tense.

Why is that? What is the reasoning behind it?

Foi útil?

Solução

Git is a distributed VCS (version control system). Multiple people can work on the same projects. It'll get changes from many sources.
Rather than writing messages that say what a committer has done. It's better to consider these messages as the instructions for what is going to be done after the commit is applied on the repo.

So write a message like this

Fix bug#1234

Instead of

Fixed bug #1234

Treat the git log not a history of your actions, but a sequence descriptions of what all the commits do.

There is a big thread on hacker news about it. There you'll get many more reasons behind this convention.

Outras dicas

It's just a (relatively) common convention so that commits messages in a project read consistently. The advice for submitting patches to Git (for example) comes from Documentation/SubmittingPatches.

  • describe changes in imperative mood, e.g. "make xyzzy do frotz" instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy to do frotz", as if you are giving orders to the codebase to change its behaviour.

As can be seen from the bracketed out subject, this convention removes the need for repeated - or alternatively implied - subjects for the commit verb that don't provide any useful benefit.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top