phpro / grumphp

A PHP code-quality tool
MIT License
4.14k stars 430 forks source link

Is it possible to modify commit message? #688

Closed TheRatG closed 4 years ago

TheRatG commented 4 years ago
Q A
Version GrumPHP 0.16.1
Bug? no
New feature? no
Question? yes
Documentation? no

Is it possible to modify commit message? For example automatically prepend git commit with a branch name.

oallain commented 4 years ago

Not to my knowledge.

We have a task to control the format of a commit message, but nothing to prefix the name of the branch. Git commit message

It may be interesting to add an option to this task to add this feature. Would you like to make a pull request?

veewee commented 4 years ago

Changing the commit message from grumphp won't be easy. Especially inside the vagrant specific hook. You need to alter a temporary file for that. Therefor I'dd suggest to keep GrumPHP for validating the commit message.

It's a better option to use the prepare-commit-msg git hook to change the commit message. This is not something that is supported by GrumPHP. More info about how that hook works: https://medium.com/@jake.henningsgaard/exploring-git-customizing-commit-messages-1a4ecb4dca69

TheRatG commented 4 years ago

Changing the commit message from grumphp won't be easy. Especially inside the vagrant specific hook. You need to alter a temporary file for that. Therefor I'dd suggest to keep GrumPHP for validating the commit message.

It's a better option to use the prepare-commit-msg git hook to change the commit message. This is not something that is supported by GrumPHP. More info about how that hook works: https://medium.com/@jake.henningsgaard/exploring-git-customizing-commit-messages-1a4ecb4dca69

Thanks for answer