On Friday, August 17, 2012 10:50:35 AM UTC+2, Fred wrote: > > Hello, > > I've defined a pre-commit hook in ~/.git_templates directory. It works > great for all my git projects, except for submodules. If i do a commit in > submodule directory pre-commit hook ist not executed. Is there a workaround? > > You need to *re-initialize* or re-clone the repositories after setting the git template dir (see the "TEMPLATE DIR" section under git init --help). Templates are only copied in during repository initialization.
You can re-initialize a repository with git init. Unfortunately, this doesn't work so well for submodules, so I would suggest you re-clone, re-init and re-update the project with submodules. OR just manually copy in the template contents. (If you *absolutely* want to re-initialize a submodule without cloning the base repository all over again, do something like cd git submodule;GIT_DIR=../.git/modules/[submodule] git init; and then edit the ../.git/modules/[submodule]/config and change bare=true to false.) Submodules also respect the template dir setting, so the hooks should pop up inside base-repo/.git/modules/[submodule]/hooks after initialization. -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To view this discussion on the web visit https://groups.google.com/d/msg/git-users/-/euMvyupKDt4J. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/git-users?hl=en.
