jbranchaud / ocelot

Because you're awesome!
4 stars 1 forks source link

Develop prepare-commit-msg hook to programmatically template commit messages with Ocelot #7

Open jbranchaud opened 11 years ago

jbranchaud commented 11 years ago

The git-scm book details the various commit hooks offered by git including the prepare-commit-msg hook:

The prepare-commit-msg hook is run before the commit message editor is fired up but after the default message is created. It lets you edit the default message before the commit author sees it. This hook takes a few options: the path to the file that holds the commit message so far, the type of commit, and the commit SHA-1 if this is an amended commit. This hook generally isn’t useful for normal commits; rather, it’s good for commits where the default message is auto-generated, such as templated commit messages, merge commits, squashed commits, and amended commits. You may use it in conjunction with a commit template to programmatically insert information.

This can be used to inject an Ocelot template into a commit message so that the developer can have something to work with. Would make the friction of using something like Ocelot even less.