Git Hook: act when a branch is advanced

I want to create and publish a latex document every time I push the tip of a particular branch.

I look at which hook I should put in my script assembly and what conditions I need to check.

+6
git githooks hook
source share
2 answers

Probably a little late ... but you can find out which branch was bound to using

if [ `git rev-parse --abbrev-ref HEAD` = "master" ]; then ... fi 

in the script when you checked the branch to commit to it.

+14
source share

If the changes are sent via push to the remote computer, then on the remote server you want to use the post-receive hook (although if you use pre-receive , then you can reject push if, say, latex does not work).

If you use a local repository, you must use post-commit (or pre-commit if you want to reject the commit).

Hooks are documented on the git hooks page.

+4
source share

All Articles