Pages

Wednesday, February 20, 2013

GIT hook script notes

One of the things I'm interested in doing is running things based on which branch or branches(s) get updated when a remote GIT repository is updated.  Examples would be something like updating a web site from a particular branch at a remote GIT repository, or sending different notifications depending on which branch is updated.

The git hook that can be used for things like that is the post-receive or post-update script. Doing a search on 'git post-receive hook' or 'git post-update hook'  results in a number of useful links.  Many if not all of them use a git repo directly for things like a remotely deployed web site. I already maintain many of my websites as branches in a git repository so that will be quite useful for me but I'm not sure that approach will work for something like the SourceForge projects.  In the case where one cannot or does not want to maintain a git repository at the base of web site directory, perhaps something like 'git archive' or just doing a 'git checkout -f' (saw examples of both) could be used to do an export of the relevant files.


In general;  searching on http://stackoverflow.com results in a lot of useful links.  For instance, one approach can be found at http://stackoverflow.com/questions/7331519/find-git-branch-name-in-post-update-hook, which also has some other related links.

Others I found interesting:








No comments:

Post a Comment