sanjay Paudel
sanjay Paudel

Reputation: 39

How do I set a pattern for git commit messages? without git hooks

How do I set a pattern for git commit messages? what are the alternatives without using git hooks

I am not able to find any solution. please help

Upvotes: 1

Views: 334

Answers (2)

deric4
deric4

Reputation: 1326

There is a configuration built in already for this:

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

and then in ~/.gitmessage something like:

Subject line (try to keep under 50 characters)

Multi-line description of commit,
feel free to be detailed.

[Ticket: X]

ref:


if you just needed a one off use of the template, or had multiple different templates:

$ git commit --template <path to template file>

Upvotes: 3

David Marx
David Marx

Reputation: 8568

One solution could be to use a wrapper tool, like the gitmoji-cli: https://github.com/carloscuesta/gitmoji

Upvotes: 1

Related Questions