I suppose you could make a custom installation – rename the hooks in .../share/git-core/templates/hooks
to remove the .sample
suffix.
You could also make a template directory full of symlinks to a hooks directory inside the repository, (e.g. post-checkout -> ../../hooks/post-checkout
). Then if the cloned repo contained that particular hook, it’d get executed.
You’re right, though, in most cases it will not happen.
Edit: I just tested it, and the --template
option does appear to preserve permissions, so that’s a much more straight-forward way to make it happen. What’d you see to indicate that it stripped that bit?
The final say on versions: You’re looking at documentation online for a newer version of git than you’re using. This feature was added in dfa7a6c (clone: run post-checkout hook when checking out); git describe says this wasn’t included until v1.6.2-rc2.