Creating a default git commit message

So the title is a bit click baity! Anyways I was reminded that this is possible when updating some git config last week. The reason you might want this is not for an actual message but to customise the comment that appears when you type git commit which would then bring up your editor. My default message has a reminder of what makes a good commit message, which I rarely read... Perhaps a better options is some examples which I could comment out.

Achieving this is very simple, drop a file called .gitmessage in your home directory and edit away! Below is a quick script snippet to get you started.

echo "# Title: Summary, imperative, start upper case, don't end with a period
# No more than 50 chars. #### 50 chars is here:  #

# Remember blank line between title and body.

# Body: Explain *what* and *why* (not *how*). Include task ID (Jira issue).
# Wrap at 72 chars. ################################## which is here:  #


# At the end: Include Co-authored-by for all contributors.
# Include at least one empty line before it. Format:
# Co-authored-by: name <user@users.noreply.github.com>
#
# How to Write a Git Commit Message:
# https://chris.beams.io/posts/git-commit/
#
# 1. Separate subject from body with a blank line
# 2. Limit the subject line to 50 characters
# 3. Capitalize the subject line
# 4. Do not end the subject line with a period
# 5. Use the imperative mood in the subject line
# 6. Wrap the body at 72 characters
# 7. Use the body to explain what and why vs. how" > ~/.gitmessage