2

I recently decided that I wanted all people who commit to my repository to fill in a simple commit log. Basically I want them to fill in a form to the commit message.

A quick search found me: How can I change the default comments in the git commit message?

Now, I can put in a hook to generate a default commit message with my form outline.

However, I understand that for security reasons, git won't let me push a hook to the others who are connected to my repository.

Alternately, I can change my commit.template to specify a template, and I will be presented with a form to fill out whenever I do a commit.

Again, I can't seem to be able to change the configuration on other peoples machines.

Is there any way to give everyone the same default commit message in git without them setting it up themselves?

Community
  • 1
  • 1
Andres
  • 5,012
  • 3
  • 24
  • 36
  • Even if this were possible, I don't think it would work in general, as the editors/commands on other folks machines wouldn't necessarily match that well with your machine. The best you can do here is probably to organize your own hooks that confirm pushes to your repo have properly formatted comments. – clstrfsck Jul 27 '11 at 00:48

1 Answers1

3

No you can neither propagate your config nor hooks.

Closest you can come to propagate your hooks to remote repositories is checking in the hooks to the repository and have scripts that will either copy them to .git/hooks or create symlinks ( and such a script would still have to be run manually, of course )

To verify that the commits adhere to the template that you want, you can have "server" side hooks that will prevent the push. If it is just about helping people to have a good default template, provide the "client" hooks like mentioned above and ask them to "install" them.

manojlds
  • 290,304
  • 63
  • 469
  • 417