{"id":18310926,"url":"https://github.com/jimschubert/hooky","last_synced_at":"2026-05-19T03:17:30.249Z","repository":{"id":139902300,"uuid":"198467944","full_name":"jimschubert/hooky","owner":"jimschubert","description":"Git hooks as plugins ;)","archived":false,"fork":false,"pushed_at":"2020-01-09T03:09:04.000Z","size":36,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-15T05:46:20.600Z","etag":null,"topics":["apache2","git","githook","githooks-plugin","hacktoberfest","productivity"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jimschubert.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"jimschubert","patreon":"jimschubert"}},"created_at":"2019-07-23T16:24:19.000Z","updated_at":"2020-10-06T00:04:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"63a00d33-826a-414f-ab5d-fe691649b57a","html_url":"https://github.com/jimschubert/hooky","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/jimschubert%2Fhooky","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimschubert%2Fhooky/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimschubert%2Fhooky/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimschubert%2Fhooky/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jimschubert","download_url":"https://codeload.github.com/jimschubert/hooky/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248036066,"owners_count":21037092,"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":["apache2","git","githook","githooks-plugin","hacktoberfest","productivity"],"created_at":"2024-11-05T16:15:54.258Z","updated_at":"2026-05-19T03:17:30.177Z","avatar_url":"https://github.com/jimschubert.png","language":"Shell","funding_links":["https://github.com/sponsors/jimschubert","https://patreon.com/jimschubert"],"categories":[],"sub_categories":[],"readme":"= Hooky: Plugin based git hooks\n:author: Jim Schubert\n:email: james.schubert@gmail.com\n\nimage:https://travis-ci.com/jimschubert/hooky.svg?branch=master[\"Build Status\", link=\"https://travis-ci.com/jimschubert/hooky\"]\n\nTired of modifying hooks within your repository to do one or more things? Tired of making the same change across project repositories?\n\n\u003e Hooky allows you to apply the logic from multiple hook plugins using git's configuration.\n\nFor instance, consider if you have some repositories in which you want a branch name and description included in each commit.\nBusiness decisions require a file changelog in every commit, but only in a handful of repositories. Suppose you already have\na `prepare-commit-msg` hook and `commit-msg` hook in those repositories. You'd need to decide which of these hooks to modify,\nand you now have hooks with differing logic across repositories.\n\nWith hooky, you may configure multiple repositories with the `branch-detail` and `taskboard` plugins, and in only the few\nrepositories which require file changes in the commit message you may enable the `changes` plugin.\n\n== Setup\n\nClone this repository to a shared location. `~/.config/hooky` is the recommended location. For other options, see\nhttps://git-scm.com/docs/git-init#_template_directory[git-init template directory].\n\nIMPORTANT: Always manually inspect the scripts in script-executing frameworks such as hooky before applying them.\n\n[source,bash]\n----\nmkdir ~/.config\ngit clone https://github.com/jimschubert/hooky.git ~/.config/hooky\n----\n\nThen, configure git to use hooky as your git template directory:\n\n[source,bash]\n----\ngit config --global init.templatedir '~/.config/hooky/git/'\n----\n\n== Usage\n\nAdd one of the supported plugins to the `hooky.plugins` config key. This is a multi-valued key.\n\nFor example, add `json-validator` and `changes`:\n\n[source,bash]\n----\ngit config --add hooky.plugins json-validator\ngit config --add hooky.plugins changes\n----\n\nRemove a plugin individually:\n\n[source,bash]\n----\ngit config --unset hooky.plugins changes\n----\n\nOr uninstall hooky from a repo completely:\n\n[source,bash]\n----\ngit config --unset-all hooky.plugins\n----\n\n== Plugins\n\n=== branch-detail\n\nPrint out the branch name and its description (if present) to each commit message.\n\n==== Configs\n\n* `branch.BRANCH_NAME.description`\n** Common git configuration option, allows you to configure a description for a git branch. To set, `git branch --edit-description`.\n\n=== changes\n\nOne of git's built-in examples, this appends diff details to the commit message (uncommented).\n\n=== json-validator\n\nVerifies that any `.json` file being added or modified represents a valid JSON syntax. By default, this passes each modified JSON file through `python -M json.tool`.\n\n==== Options\n\n|===\n|Key |Description |Default\n\n|`hooky.json-validator.command`\n|Defines the json common to invoke. Individual JSON files are passed as an argument following this command.\n|`python -m json.tool`\n\n|`hooky.json-validator.defer-empty`\n|Whether or not we all the command defined above to decide if a completely empty JSON file is valid. If set to false, an empty file is considered invalid JSON, which matches behavior of the default command, `python -m json.tool` and the JSON specification.\n|`false`\n|===\n\n\n=== taskboard\n\nEvaluates a branch name for common taskboard patterns, and appends a link to the taskboard location in a commit message.\n\n==== Options\n\n|===\n|Key |Description |Default\n\n|`hooky.taskboard.prefix`\n|Defines the prefix used to determine if a branch is in a taskboard format. Evaluation becomes the format `prefix`-`digits`.\n|N/A\n\n|`hooky.taskboard.urltemplate`\n|Provides the non-digit part of a URL to your branch's related task item.\n|N/A\n\n|`hooky.taskboard.separator`\n|Defines the separator used between the board prefix and digits, e.g. `prefix`-`digits` or `prefix`/`digits`.\n|`-`\n\n|`hooky.taskboard.once`\n|Constrain the appended URL to occurring only once, up to the branch point. By default, appends on every commit.\n|`false`\n|===\n\n== Contributing\n\n// TODO\n\n== Testing\n\nTests are written with bats. Please follow bats-core https://github.com/bats-core/bats-core[installation instructions] before running tests.\n\n== Extending\n\nHooky can be used as a starter point for your plugin infrastructure a well. Just clone this repo, and add your plugins under\n`git/hooks/plugins/PLUGIN_NAME`. A plugin may have one or more git hooks defined; create the hook (e.g. `prepare-commit-msg`, `commit-msg`, or both),\nand make sure these hooks are executable.\n\nHooky will traverse all plugins defined in the git config element `hooky.plugins`, and execute these according to which top-level hook\nhas invoked the `hooky` function (see `git/hooks/pre-commit`, for instance). If hooky doesn't include the top-level hook, just add it and invoke the hooky function.\nFor example, to enable `pre-push` hooks in your fork, in `git/hooks/pre-push`, add this minimal script:\n\n[source,bash]\n----\n#!/usr/bin/env bash\n. \"$(git --exec-path)/git-sh-setup\"\n. \"$GIT_DIR/hooks/hooky.sh\"\nhooky \"pre-push\" \"$@\"\n----\n\nEnsure that the new `pre-push` file is executable. Now, git will invoke `pre-push` and your pre-push hook will invoke hooky,\nwhich in turn invokes all `pre-push` hooks for any enabled plugin which defines it.\n\n== License\n\nlink:./LICENSE[Apache 2.0]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimschubert%2Fhooky","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjimschubert%2Fhooky","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimschubert%2Fhooky/lists"}