How to Set a Default Commit Message

Publikováno: 2.3.2020

Having a default commit message is really useful for a number of reasons: It can formalize your commit messages It serves as a good reminder for the information you should add to your commit message, like issue number If you set it to “Drunk AF, don’t accept this” To set a default commit message on […]

The post How to Set a Default Commit Message appeared first on David Walsh Blog.

Celý článek

Having a default commit message is really useful for a number of reasons:

  • It can formalize your commit messages
  • It serves as a good reminder for the information you should add to your commit message, like issue number
  • If you set it to “Drunk AF, don’t accept this”

To set a default commit message on your local machine, start by executing the following from command line:

git config --global commit.template ~/.gitmessage

This tells your local git config to pull the text from ~/.gitmessage as the default commit message. You could set the text to something like:

Fix Issue #{number}: {description}

R+: {reviewer}

Of course, if you set your commit message via git commit -m {description}, the default will not be used, so it’s a win-win!

The post How to Set a Default Commit Message appeared first on David Walsh Blog.

Nahoru
Tento web používá k poskytování služeb a analýze návštěvnosti soubory cookie. Používáním tohoto webu s tímto souhlasíte. Další informace