Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is it considered good practice to describe git commits in the present tense?

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?

like image 245
Madara's Ghost Avatar asked Dec 13 '12 13:12

Madara's Ghost


People also ask

Why are commits in present tense?

History (i.e. commit messages) is written as something that was done in the past (e.g. the problem was fixed). The thing is, using imperative, present tense works for huge projects (e.g. Linux) so it obviously scales. In addition, it requires pretty much zero effort using over past tense.

Is it a good practice to use the present tense in commit messages?

It is a good practice to use present tense in commit messages.

Why are commit messages best written in the present tense?

As I understand it, the present tense means that the commit itself fixes the issue, not the developer which could be implied by using the past tense -"the developer fixed the issue". I believe it would be the code being committed that fixes the issue, not the action of the commit.

What tense should commits be in?

Imperative (a.k.a. present tense) It tells someone what applying that commit will do, so it should read something like If I apply this commit, it will [make foo do something...]


1 Answers

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.

like image 115
Shiplu Mokaddim Avatar answered Sep 20 '22 14:09

Shiplu Mokaddim