How to do it...

We will configure our newly created template, and then we will make a commit that will utilize the template.

To configure the template, we need to use git config commit.template <pathtofile> to set it, and, as soon as it is set, we can try to create a commit and see how it works:

  1. Start by configuring the template as follows:
$ git config commit.template  ~/committemplate
  1. Now list the config file to see that it has been set:
$ git config --list | grep template
commit.template=/Users/JohnDoe/committemplate
  1. As we predicted, the configuration was a success. The template, just like any other configuration, can be set at a global level using git config --global, or it can be set at a local repository level by leaving out the ...

Get Git Version Control Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.