Home > front end >  How do I set a pattern for git commit messages? without git hooks
How do I set a pattern for git commit messages? without git hooks

Time:12-06

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

CodePudding user response:

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>

CodePudding user response:

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

  • Related