Did you know you can customise the default git message template?
First create a file, ~/.gitmessage
.
Then run git config --global commit.template ~/.gitmessage
.
Whatever you put in that file will be the default text opened in your editor when you start a commit message.
I found this useful because as a technical lead, I spend most of my coding time pair programming. Github has a nice feature where you can add co-authors to your commits. So my template contains a few Co-authored-by
lines for people I work with, like this:
Co-authored-by: Fox Mulder <fox.mulder@fbi.gov>
Co-authored-by: Dana Scully <dana.scully@fbi.gov>
This way, I can quickly delete the lines I don't need when I write the message, rather than writing the Co-authored-by
from scratch each time.
These lines are called "trailers" and go at the end of the message. They are not standardised but there are various tools which interpret them.