{"id":19231458,"url":"https://github.com/fabiomaggio/git-hooks","last_synced_at":"2025-04-21T03:31:57.405Z","repository":{"id":78142076,"uuid":"88131498","full_name":"fabiomaggio/git-hooks","owner":"fabiomaggio","description":"A collection of Git hooks","archived":false,"fork":false,"pushed_at":"2017-04-21T09:58:28.000Z","size":13,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-01T08:52:02.125Z","etag":null,"topics":["commit","commit-conventions","commit-message","git","git-hooks","hooks","hooks-folder"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fabiomaggio.png","metadata":{"files":{"readme":"README.md","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-13T06:17:12.000Z","updated_at":"2025-03-18T05:06:38.000Z","dependencies_parsed_at":"2023-03-15T02:02:32.552Z","dependency_job_id":null,"html_url":"https://github.com/fabiomaggio/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/fabiomaggio%2Fgit-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiomaggio%2Fgit-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiomaggio%2Fgit-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiomaggio%2Fgit-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabiomaggio","download_url":"https://codeload.github.com/fabiomaggio/git-hooks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249991030,"owners_count":21357191,"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":["commit","commit-conventions","commit-message","git","git-hooks","hooks","hooks-folder"],"created_at":"2024-11-09T15:42:41.577Z","updated_at":"2025-04-21T03:31:57.396Z","avatar_url":"https://github.com/fabiomaggio.png","language":"Shell","readme":"# Git hooks\n\nThis is a collecion of hooks that enforce a clean commit policy:\n* `pre-commit` disables committing files on the **master** branch.\n* `commit-msg` checks if a commit message follows the rules that are described in [this article](https://chris.beams.io/posts/git-commit/).\n* `.git-commit-msg-template.txt` is a default template for a commit message\n\n## Installation\nClone this repository on your device\n\n### Commit message template\nTo use the commit message template you copy the .git-commit-msg-template.txt file to your home\ndirectory (or a path that you choose).\n\nYou can set this file as the default template for your commit messages:\n```bash\ngit config --global commit.template ~/.git-commit-msg-template.txt\n```\n\nEach time you `git commit` you will be presented the contents of the template.\nIf you use PhpStorm as a Git client you can use [this plugin](https://plugins.jetbrains.com/plugin/9364-commit-message-template) to make use of commit templates.\n\n### Hooks\nYou can use the hooks for a specific repository or install them for each repository.\nThe hooks will be triggered each time you try to commit.\n\n#### Single repository installation\nCopy the `pre-commit` and `commit-msg` files to the hooks folder of your repository:\n```bash\ncp {pre-commit,commit-msg} path-to-your-repo/.git/hooks \u0026\u0026 chmod +x path-to-your-repo/.git/hooks/{pre-commit,commit-msg}\n```\n\n#### Global installation\nCreate a folder that will hold the hooks\n```bash\nmkdir -p ~/.git-template/hooks\ngit config --global init.templatedir '~/.git-template'\ncp path-to-cloned-repo/{pre-commit,commit-msg} ~/.git-template/hooks\nchmod +x ~/.git-template/hooks/{pre-commit,commit-msg}\n```\n\nThe hooks will now be set after each `git init` or `git clone`. You can also re-run `git-init` on an existing repository to update the hooks folder.\n\n## Configuration\n* You can choose to have the branch name appended to the commit message by enabling this behavior in the git configuration:\n```bash\ngit config git-hooks.append-branch-name true\n```\n\nBy default this key will not be set and the branch name will not be appended (or if you set it to **false**).\nThe key accepts **true** or **false** as possible values.\n\n* Committing on the **master** branch can be enabled with the following command:\n```bash\ngit config git-hooks.commit-on-master true\n```\n\nBy default this key will not be set and committing on the **master** branch will be disabled (or if you set it to **false**).\nThe key accepts **true** or **false** as possible values.\n\nAll configuration options can be setup for all of your repositories by passing the `--global` flag to the above commands.\nOtherwise the configuration applies only to a single repository.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiomaggio%2Fgit-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabiomaggio%2Fgit-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiomaggio%2Fgit-hooks/lists"}