Why I don't commit with -m

A lot of tutorials show using git commit -m to create commits using an inline message.

I don't do that, though.

Using the -m option to specify an inline commit message encourages writing short one-line commit messages instead of using the subject and body effectively to document more about the change, such as why it was needed, any other approaches taken and the consequences of the change within the commit.

Alternatively, people could write a longer commit message in one line and not follow the 50 character limit for the subject line.

Whilst it's possible to write multi-line commits on the command-line, I use my editor (Neovim) to write my commit messages.

I can write as much information as I need, I have coloured columns for the 50 character subject limit and the 72 characters for wrapping the body message and, if I write more than that, it will either wrap for me, or I can format the message for it to be compliant.

These are rules that aren't also enforced in some Git tools, so I prefer knowing my setup is configured correctly.

Though, whether you use -m or not, capture as much information in the message as you can, as future Developers on the project (including you) will thank you for it.

- Oliver

Was this interesting?

Sign up here and get more like this delivered straight to your inbox every day.

About me

Picture of Oliver

I'm an Acquia-certified Drupal Triple Expert with 17 years of experience, an open-source software maintainer and Drupal core contributor, public speaker, live streamer, and host of the Beyond Blocks podcast.