{"id":23843869,"url":"https://github.com/oppodelldog/git-commit-hook","last_synced_at":"2025-09-07T19:32:17.574Z","repository":{"id":64304906,"uuid":"134876758","full_name":"Oppodelldog/git-commit-hook","owner":"Oppodelldog","description":"automatically prepend branch name in git commit message, useful when working with feature/branches and a jira for example","archived":false,"fork":false,"pushed_at":"2023-04-01T12:23:49.000Z","size":75,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-06-21T06:24:19.174Z","etag":null,"topics":["automation","commit-hooks","git","git-flow","goland","jetbrains-ides","jira","phpstorm"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Oppodelldog.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2018-05-25T15:52:20.000Z","updated_at":"2023-04-01T12:23:58.000Z","dependencies_parsed_at":"2024-06-20T04:54:57.238Z","dependency_job_id":null,"html_url":"https://github.com/Oppodelldog/git-commit-hook","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oppodelldog%2Fgit-commit-hook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oppodelldog%2Fgit-commit-hook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oppodelldog%2Fgit-commit-hook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oppodelldog%2Fgit-commit-hook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Oppodelldog","download_url":"https://codeload.github.com/Oppodelldog/git-commit-hook/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232250733,"owners_count":18494772,"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":["automation","commit-hooks","git","git-flow","goland","jetbrains-ides","jira","phpstorm"],"created_at":"2025-01-02T19:51:27.173Z","updated_at":"2025-01-02T19:51:27.802Z","avatar_url":"https://github.com/Oppodelldog.png","language":"Go","readme":"[![Go Report Card](https://goreportcard.com/badge/github.com/Oppodelldog/git-commit-hook)](https://goreportcard.com/report/github.com/Oppodelldog/git-commit-hook) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://raw.githubusercontent.com/Oppodelldog/git-commit-hook/master/LICENSE) [![Linux build](http://nulldog.de:12080/api/badges/Oppodelldog/git-commit-hook/status.svg)](http://nulldog.de:12080/Oppodelldog/git-commit-hook)\n\n# git-commit-hook\n\u003e configureable git commit hook\n\n### 1. Install\n\nDownlod the binary, put it into a folder of your $PATH (for example. /usr/local/bin).\n\nEnsure your user has execution permissions on that file.\n\n### 2. Configure\nThere are several places you can put the configuration.\n\nCreate a config file named ```git-commit-hook.yaml```.\n\nCreate the configuration below your user folder:\n\n**/home/*user*/.config/git-commit-hook**\n\n\n```yaml\n \"project xyz\":\n   # path to the git repository\n   path: \"/home/nils/projects/xyz/.git\"\n\n   # define types of branch and a pattern to identify the type for the current branch you are working on\n   branch:\n      master: \"^(origin\\\\/)*master\"\n\n   # define a commit message template per branch type, or as here for all (*) branch types\n   template:\n     \"*\": \"{.BranchName}: {.CommitMessage}\"\n\n   # define validation rules per branch type\n   validation:\n      master:\n        \"^.*(#\\\\d*)+.*$\" : must have a ticket reference (eg. #267)\n ```\n\nWatch out the test [fixture](config/test-data.yaml) for full feature sample\n\n### 3. Activate\nUse the subcommand ```install``` to activate the commit-message-hook in your repository.\n\n\n## Sub-Commands\nThere are some useful subcommands which ease the use of the commit-message hook.\n\n### git-commit-hook install\nInstalls the commit-hook in the configured repositories.\n\nYou need to specify either **-p** or **-a**.\n\n* **-p** to install in the given repository (eg. **-p \"project xyz\"**)\n* **-a** to install in all configured repositories\n\nIf there's already a commit-message-hook installed, you can overwrite by adding ```-f```.\n\n### git-commit-hook uninstall\nUninstalls the commit-hook from the configured repositories.\n\nYou need to specify either **-p** or **-a**.\n\n* **-p** to uninstall from the given repository (eg. **-p \"project xyz\"**)\n* **-a** to uninstall from all configured repositories\n\n### git-commit-hook diag\nGives an overview of the configuration and the installed commit hooks\n\n### git-commit-hook test\n\nThe test command is useful to test configuration and simulate a commit-situation.\n\nYou may input the following parameters:\n* **-p** project name\n* **-b** branch name\n* **m** commit message\n\n**Sample:**\n\n```shell\ngit-commit-hook test -m \"short commit message\" -b master -p testrepo\n```\n\nin this case, validation will fail, since it's required to give a ticket/issue reference in the commit message.\n\n```shell\ntesting configuration '/home/nils/.config/git-commit-hook/git-commit-hook.yaml':\nproject        : testrepo\nbranch         : master\ncommit message : short commit message\n\nvalidation error for branch 'master'\nat least expected one of the following to match\n - must have a ticket reference (eg. #267)\n```\n\nIf you pass a valid commit message\n```shell\ngit-commit-hook test -m \"fix #121\" -b master -p testrepo\n```\n\nshows not validation errors, but shows the finally rendered message.\n```shell\ntesting configuration '/home/nils/.config/git-commit-hook/git-commit-hook.yaml':\nproject        : testrepo\nbranch         : master\ncommit message : fix #121\n\nwould generate the following commit message:\nfix #121\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foppodelldog%2Fgit-commit-hook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foppodelldog%2Fgit-commit-hook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foppodelldog%2Fgit-commit-hook/lists"}