github - How do I conditionally, automatically, add information to git commits comments? -


i'm looking automatically add information git commit comments.

for example, can run script in pre-commit phase , detect whether there changes sort of application configuration templates, , add comment git commit effect (say, "warning! commit changes configuration templates, may need full rebuild changes")

does git provide through existing tool/extension/api call?

there prepare-commit-msg hook can used generate initial commit message before opening editor:

prepare-commit-msg
hook invoked git commit right after preparing default log message, , before editor started.

there commit-msg hook can used modify commit message:

commit-msg
hook invoked git commit, , can bypassed --no-verify option. takes single parameter, name of file holds proposed commit log message. exiting non-zero status causes git commit abort.

either of 1 of these used implement behavior you're looking for. implement logic in either 1 of these, depending on whether wanted message available default (but amendable editing) or unilaterally set regardless of commit message provided user.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -