Pre-fill git commit message

Paul Sweeney · 20th January 2020

To have the git commit message pre-populated with a standard value…

  • Create a file in the repo .git directory named e.g. .git/.gitmessage.txt containing the required message, e.g. a template for the dev to follow such as that given in the git docs or just a generic:
    update
    
  • add the following content to .git/config
    [commit]
      template = .git/.gitmessage.txt
    

:information_source: The .git/config and .git/.gitmessage.txt files are just on the local environment, so:

  • they won’t get pushed to upstream repo
  • this will need to be redone for each environment/repo clone