DEV Community

What tense do you use in Git Commit messages?

Jonathan Irvin on November 05, 2018

Let's pick each other's brains for a sec. Do you use past or imperative tense in your commit messages? Past added button to page ...
Collapse
 
hardkoded profile image
Darío Kondratiuk

I love these guidelines chris.beams.io/posts/git-commit/

”A properly formed Git commit subject line should always be able to complete the following sentence:

If applied, this commit will your subject line here
For example:

If applied, this commit will refactor subsystem X for readability”

Collapse
 
ewoks profile image
Beeblebrox

Meaning imperative instead of present or past tense

Collapse
 
cjbrooks12 profile image
Casey Brooks

I usually use the present tense. It sounds more natural when thinking in terms of "what does this specific commit do". I think of a commit is a snapshot of an event, rather than a fixed point in history or a changelog.

Collapse
 
jerodsanto profile image
Jerod Santo

It sounds more natural when thinking in terms of "what does this specific commit do".

+1000 to this. It also lends itself to easier reading/scrolling through git log. 👌

Collapse
 
dopitz profile image
Daniel O. • Edited

Here is a small statistic based on the Github commit messages:

Fix: 25M
Fixed: 12M
Fixing: 22M
Fixes: 23M

Add: 25M
Added: 22M
Adding: 19M

Update: 18M
Updated: 14M
Updating: 18M

Remove: 25M
Removed: 18M
Removing: 18M
Removal: 7M

Delete: 7M
Deleted: 8M
Deleting: 9M

We can see that the imperative is used a little more than the past tense.

Personally, I use past tense because it sounds more polite.

Collapse
 
dmfay profile image
Dian Fay • Edited

The imperative is a mood not a tense! :) I use present tense and follow the Conventional Commits specification on most projects ("fix: disable current deployment type in index filters").

Collapse
 
smuschel profile image
smuschel

I'm using past tense (at least mostly) because the commit reflects something I did in the past. Seems natural to me this way...

Collapse
 
acostalima profile image
André Costa Lima • Edited

I usually follow the guidelines proposed here which I think they make valid points. See section 5: use the imperative mood in the subject line.

I also adhere to the Conventional Commits spec.

Collapse
 
claire profile image
Claire Martinez

I finish this sentence "If you pull this it ..."

i.e.
adds new feature to menu
updates readme
fixes broken sql

Collapse
 
jochemstoel profile image
Jochem Stoel

This is good.

Collapse
 
foresthoffman profile image
Forest Hoffman

Using imperatives is the official way of writing commit messages, as if each message were prefixed by "This commit will...". I personally prefer this as it's very straightforward and shortens some messages by a few characters.

From git-scm.com/book/en/v2/Distributed...

It's also a good idea to use the imperative present tense in these messages. In other words, use commands. Instead of "I added tests for" or "Adding tests for," use "Add tests for."

Collapse
 
joelnet profile image
JavaScript Joel • Edited

I like to use Imperative for consistency with Jira tickets.

ABC-1234 add Either type
-------- ---------------      
    \           \
  Ticket       Title
Collapse
 
yaser profile image
Yaser Al-Najjar • Edited

I was using past tense till I realized present simple is being used in GitHub, GitLab, and GitKraken commits (Add/Update README, Merge: foo, Revert: bar).

Collapse
 
refack profile image
Refael Ackermann

I use present these.
For the title 3rd person singular, reffing to the commit as the object:

tools: add new feature

In the body I use second person singular, referring to the commit as the subject:

* fixes something
* adds something else
Collapse
 
yorodm profile image
Yoandy Rodriguez Martinez

It depends on the level of my caffeine gauge

Collapse
 
derek profile image
derek • Edited

Because Tower and Git Kraken have character limits in subject lines...

I too am guilty of using emojis 😀 ie:

  • 🐳(docker)
  • 📦(package)
  • 🐛(bug)
  • 🔧(fix)
  • ⚠ (warn)
  • 🚧 (WIP)
  • 👀(need more eyes on it)
  • ❓(questionable code, probably need to refactor)

I also use shell cmd abbreviations:

  • rm = remove
  • cp = copy
  • mv = moved/renamed
  • * = wildcard things

I love Tower and Git Kraken because it's easy to select the specific lines to group LOC that is coherent to the given context of the commit.

In the commit body I try to use numbers as a convention:

ie:

  1. What: Create an Eat() fn.
    • Feeds a 🤖
  2. Why: Fuels 🤖to calculate numbers
    • If 🤖doesn't eat, it doesn't calculate
    • A 😀 🤖is a productive 🤖
  3. How: Mostly uses 🌮s and 🍲
    • Uses a 🦄library
    • Definitely 🎩 in that 🦄library
Collapse
 
dmahely profile image
Doaa Mahely

I'm very much a git newbie. I learned it a few months ago from Udacity and I believe the only directive given regarding commit messages was to use verbs! However, I regularly use the past tense when I write commit messages. This is because I look at my log when I try to think of what I did, so things like added, removed and fixed etc. But a lot of people have raised good points about using the present tense. I may make the switch in my next repo.

Collapse
 
cathodion profile image
Dustin King

Imperative. I don't know why, but I picked it up as the norm at some point.

This is a retroactive justification, but it seems natural to read each commit as though it's happening right now, or that the commit headline is the instruction and the code changes are carrying it out.

Collapse
 
edmar profile image
Edmar S. Gonçalves

Present continuous tense feels more natural to me.
E.g. "fixing blah blah..." Vs "fixed blah blah..." Or "fix blah blah...".
Reason is that it shows the original intent because really it's not "fixed" or is a "fix" until it has been reviewed, gone through automation and qa testing and finally merged.

Collapse
 
itsasine profile image
ItsASine (Kayla)

Imperative, because in theory, I could revert that commit that adds something later. Version control is a constant present state that can change freely. I'm unlikely to ever actually need change management on a personal project, but I do want to keep with the spirit of it all.

Though, admittedly, if I'm doing a bunch of stuff all at once that would be a mess to change later, I tend to past tense it like "Added this, updated README, bumped dependencies, changed this" because 1 commit with all that mess isn't ever getting reverted.

Collapse
 
jacquesbenzakein profile image
Jacques “Blockchain” Benzakein

I usually do it in past tense because I kind of view it as a log of all the things I've gotten done. The same way if someone asked what you did today, you'd say "I went to the store, I gazed at some clouds, I worked out (lol)," if someone asks what I've gotten done on a project, I'd say I "added button to page."

Collapse
 
simoroshka profile image
Anna Simoroshka

Imperative and the first letter capitalised. But sometimes I just write whatever I feel and put smiley faces or crying ones (not at work =P)

Collapse
 
grmnsort profile image
German Rodriguez Ortiz

For my WIP commits, I usually use the present tense, but when I squash them into proper "finished" commits, I will write the new commit message in the imperative mood.

Collapse
 
qm3ster profile image
Mihail Malo

Im🍐ative, like recipe steps.
It's usually less characters too.

Collapse
 
stephanie profile image
Stephanie Handsteiner • Edited

In the beginning I was using past tense and tbh I wasn't even very consistent in writing my commit messages as well (I didn't know better, I guess). Meanwhile I'm using the imperative mood. :)

Collapse
 
pronoob13 profile image
Pim Stoit

I name my commits after what they do. A commit that "adds a button to the page" or "resolves bug #1746"

Collapse
 
jenbutondevto profile image
Jen

I'd never thought about this before but turns out I am completely inconsistent with it. Oops!

Collapse
 
mattmoranjava profile image
Matt Moran

I favour past tense because you're describing what you did, not writing a @TODO telling someone what needs doing.

Collapse
 
vlasales profile image
Vlastimil Pospichal

Imperative for simplicity and for non-english readers.

Collapse
 
jeffreyuvero profile image
Jeffrey E. Uvero

I used past tense but after reading this I will use imperative

Collapse
 
vineykumar90 profile image
Viney Kumar

I was using past tense for a couple of years until I came across an article about how to write commit messages (P4 in my case). Since then, present tense has made more sense to me.