I'm looking to build and publish a latex document every time I advance the tip of a specific branch.
I'm looking at what hook I should be putting my build script and which conditions I need to check for.
If you want enforcement, use an update hook in the central repo. If the hook is doing per-commit verification, you can still provide a pre-commit hook; developers will likely adopt it voluntarily, so that they can find out right away when they've done something wrong, rather than waiting until they try to push.
Use the --no-verify option to skip git commit hooks, e.g. git commit -m "commit message" --no-verify . When the --no-verify option is used, the pre-commit and commit-msg hooks are bypassed.
The pre-commit hook is run first, before you even type in a commit message. It's used to inspect the snapshot that's about to be committed, to see if you've forgotten something, to make sure tests run, or to examine whatever you need to inspect in the code.
Probably a little late... but you can find out which branch was committed to by using
if [ `git rev-parse --abbrev-ref HEAD` = "master" ]; then
...
fi
in you script when you checked out the branch to commit in it.
If changes are coming in via a push
to a remote, then on the remote server you'll want to use the post-receive
hook (though if you use pre-receive
then you can reject the push if, say, latex fails).
If you're using your local repository you should use post-commit
(or pre-commit
if you want to be able to reject the commit).
The hooks are documented in the git hooks man page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With