I read the advice here some time ago, and I've been following it by and large.

However, only recently I discovered how to enforce a line limit when git-commit starts up nano:

~/.gitconifg:

[core]
    editor = nano -r 72

The problem is that doesn't help limit the summary to 50 characters, which is what you need for log, shortlog, Github and general readability.

I've now expanded this into a full replacement for git's commit template. It's automated with ansible as part of my local-setup.

Edit your global git config to include:

[commit]
    template = ~/.gitmessage

Alternatively, run:

git config --global commit.template ~/.gitmessage

And create your .gitmessage file:



# First thing's first: your <= 50 char summary ##
########################################### c50 ↑

# Write your description below this block ####################### c72 ↓
# Explain the problem that this commit is solving. Focus on why you are
# making this change as opposed to how (the code explains that).
# Are there side effects or other unintuitive consequences of this
# change? Here's the place to explain them.
##################################################################### ↓


The markdown parser in Ghost is removing some subtleties with the placement of new lines and lengths. The raw file in all its glory can be found on Github.

Here's a oneliner to set yours:

$ wget https://raw.githubusercontent.com/bencromwell/local-setup/master/git/files/gitmessage -O ~/.gitmessage