{"id":15685649,"url":"https://github.com/vaab/git-hooks","last_synced_at":"2025-05-07T17:29:34.279Z","repository":{"id":4738144,"uuid":"5887395","full_name":"vaab/git-hooks","owner":"vaab","description":"Git hooks shell management framework.","archived":false,"fork":false,"pushed_at":"2014-10-01T09:43:58.000Z","size":156,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-31T12:21:35.162Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"hasbridge/php-color","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vaab.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-09-20T14:03:22.000Z","updated_at":"2024-11-28T16:30:38.000Z","dependencies_parsed_at":"2022-08-19T13:11:15.694Z","dependency_job_id":null,"html_url":"https://github.com/vaab/git-hooks","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaab%2Fgit-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaab%2Fgit-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaab%2Fgit-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaab%2Fgit-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vaab","download_url":"https://codeload.github.com/vaab/git-hooks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252926211,"owners_count":21826266,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T17:28:16.378Z","updated_at":"2025-05-07T17:29:34.227Z","avatar_url":"https://github.com/vaab.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"=========\ngit-hooks\n=========\n\n``Git-hooks`` provides a simple shell framework to manage your git hooks.\n\nThis project is quite new and only supports the ``post-receive`` git hook,\nimplementing the other hooks could be quickly implemented.\n\n\nSample usage session\n--------------------\n\n::\n\n  git-hooks add release-on-tag [0-9]+.[0-9]+.[0-9]+(-.*)? /var/www/packages\n\nWill create a file ``/var/www/packages/mygitrepos-0.0.1.tar.gz`` when you'll push\na tag ``0.0.1`` on this repository.\n\n::\n\n  git-hooks add sync-workdir stable www.example.com /var/www/myrepos\n\nWill maintain git repository ``www.example.com:/var/www/myrepos`` up to date\nwith ``stable`` branch of current repository whenever you'll push change on\nthis branch.\n\nBoth of these tags could live on the same repository without problems.\n\n\nUsage\n-----\n\nBefore using system wide ``git-hooks``, please set up the general git variable::\n\n  git config --system git-hooks.install-dir MY_GIT_HOOKS_BASE_DIR\n\nOnce this is done, you are free to run the given previous examples.\n\nHelp is provided at each levels::\n\n  $ git-hooks\n  You should provide a sub-command.\n\n  This is the list of supported sub-commands:\n      git-hooks add HOOK [HOOK-OPTIONS...]\n      git-hooks init\n\n  $ git-hooks add\n  You should provide a hook name.\n\n  These are the available hooks:\n    - release-on-tag\n    - sync-workdir\n    - update-publish-dir\n\n  usage: git-hooks add HOOK [HOOK-OPTIONS...]\n\n\nInternals\n---------\n\nFiles and directory\n'''''''''''''''''''\n\nIn an existing git repository::\n\n  git-hooks init\n\nwill setup the necessary files to manage hooks with ``git-hooks``. Please remember\nthat this command is NOT required for any examples to work, as it is executed\nautomatically if not already done by any previous ``git-hooks`` command.\n\nInit will create a generic hook file in the ``.git/hooks/\u003cgit-hook-name\u003e``\nfiles that sets up the framework, and a directory for each hook.\n\nFor the moment only the ``post-receive`` hook has been implemented. So it\ncreates a ``.git/hooks/post-receive`` hook file, which will parse the\n``~/.git/hooks/post-receive.d/`` directory for individual hook, each one in a\nfile.\n\nAdding a hook\n'''''''''''''\n\nHooks are standalone shell script ending with \".hook\" providing some predefined\nshell function. Hooks are found in the base installation of ``git-hooks``, in the\n``hooks`` subdirectory. This file provides the control part of the hook.\n\nWhen calling ``git-hooks add myhook`` you'll trigger the ``install`` function of your\nhook, and it's job is to create a \"myhook.conf\" file. This file configures the behavior\nof your hook.\n\n``post-receive_ref`` function will be called upon each reference received by git.\n\n``post-receive_post`` function will be called once all ref has been received.\n\n\nHooks\n-----\n\nThese hooks are already written and might give you some hints how to implement\na new one.\n\n\ncascade-push\n''''''''''''\n\n\nSynopsis\n\n    ::\n\n        git-hooks add cascade-push TARGET_BRANCH_REGEX REMOTE\n\nDescription\n\n    This hook will push selected branch to a specific remote. A branch ref\n    matching the TARGET_BRANCH_REGEX will trigger the command::\n\n        git push REMOTE TARGET_BRANCH_REGEX\n\nOptions\n\n    TARGET_BRANCH_REGEX\n\n        Regex to pinpoint the which branch will trigger the hook\n\n    REMOTE\n\n        Remote alias to which the target branch will be pushed to.\n\n\n\nrelease-on-tag\n''''''''''''''\n\nSynopsis\n\n    ::\n\n        git-hooks add release-on-tag TARGET_TAG_REGEX HOST DISTANT_REPO_DIR\n\nDescription\n\n    On tag pushed matching the TARGET_TAG_REGEX, a ``tar.gz``\n    export of the corresponding work tree will be sent via ``scp`` to\n    HOST:DISTANT_REPO_DIR repository.\n\nOptions\n\n    TARGET_TAG_REGEX\n\n        Regex to filter tag which will trigger the hook.\n\n    HOST\n\n        Remote host that will be used for the ``scp`` command.\n\n    DISTANT_REPO_DIR\n\n        Remote directory (on the HOST) that will be used to specify destination\n        location for the ``scp`` command.\n\n\n\nbzr-push\n''''''''\n\nSynopsis\n\n    ::\n\n        git-hooks add bzr-push BZR_IDENT TARGET_BRANCH_REGEX BRANCH_NAME_SUBST_REGEX\n\n\nDescription\n\n    On branch pushed matching the TARGET_BRANCH_REGEX, it'll be converted\n    and pushed to launchpad on the account identified by BZR_IDENT.\n\n    The branch name will be used and transformed thanks to BRANCH_NAME_SUBST_REGEX\n    to create the target launchpad branch name.\n\n    Note that you might want to test that you can actually push with the\n    user account that will launch the hook. This might requires some\n    setup to be made.\n\n    This hook requires ``git-bzr-ng`` to be installed.\n\n    This hook is to be considered early-alpha stage.\n\n\nOptions\n\n    BZR_IDENT\n\n        Launchpad account identifier (can be a team or a user account).\n\n    TARGET_BRANCH_REGEX\n\n        Regex to filter branch which will trigger the hook.\n\n    BRANCH_NAME_SUBST_REGEX\n\n        Substitution regex (ie:``s%^lp/(.+)$%\\1%g``) that will be used to\n        get the target bazar branch name from the triggering branch name.\n\n        This is quite important as launchpad won't tolerate some characters\n        as ``/``. So you should make sure to remove them.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaab%2Fgit-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvaab%2Fgit-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaab%2Fgit-hooks/lists"}