I use nano for git commit messages. Short summary (<=50 chars) plus a new line before the description is relatively straightforward to stick to. However, when it comes to wrapping at 72 chars in the description body I just go off what seems to look right, making for inconsistent logs.
In Vagrantfiles I've seen this sort of thing to tell the editor what to do for vi/vim:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Is there something like that for nano, and a template somewhere for git commit, that means I can ensure that nano would be set up for the correct line wrapping when in the context of a git commit message?
The maximum lengths of the subject and message body can be configured in the standard Gerrit config file gerrit. config . The defaults are 50 characters for the summary and 72 characters for the description, as recommended by the git tutorial and expanded upon by Tim Pope.
Length: The first line should ideally be no longer than 50 characters, and the body should be restricted to 72 characters. Content: Be direct, try to eliminate filler words and phrases in these sentences (examples: though, maybe, I think, kind of).
Nano supports the passing of command line arguments when starting it.
This can be leveraged as part of the git editor config setting.
git config --global core.editor "nano -r 72"
Or:
export GIT_EDITOR='nano -r 72'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With