{"id":21605977,"url":"https://github.com/archf/git-hooks","last_synced_at":"2025-03-18T14:41:12.899Z","repository":{"id":36380043,"uuid":"40684913","full_name":"archf/git-hooks","owner":"archf","description":"a shell script to manage user git hooks","archived":false,"fork":false,"pushed_at":"2020-06-29T14:12:27.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-24T19:16:42.778Z","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":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/archf.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}},"created_at":"2015-08-13T22:40:28.000Z","updated_at":"2020-06-29T14:12:29.000Z","dependencies_parsed_at":"2022-09-06T06:22:37.820Z","dependency_job_id":null,"html_url":"https://github.com/archf/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/archf%2Fgit-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archf%2Fgit-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archf%2Fgit-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archf%2Fgit-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/archf","download_url":"https://codeload.github.com/archf/git-hooks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244242854,"owners_count":20421951,"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-11-24T20:18:25.354Z","updated_at":"2025-03-18T14:41:12.865Z","avatar_url":"https://github.com/archf.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# git-hooks\n\nA simple script to manage your hooks.\n\n## Why do I need this?\n\nRerunning `git init` within an existing git repository will result in only\ngit 'templatedir' **new hooks** actually missing in `.git/hooks` to be added.\nThus, exising hooks are not updated!\n\nYou would have to manually delete a file to force a new copy into the git\nrepository. This script streamline this process.\n\n## How does it work!\n\nIn this order\n\n1. Lookup your `.gitconfig` for the `templatedir` parameter. You can retreive\n   current value using `git config --global init.templatedir` command. If\n   `templatedir` does exist, it will then look for hooks in\n   `\u003ctemplatedir\u003e/hooks/*`\n2. For each file:\n  * a backup will be done in current repository `.git/hooks.old` if it already\n  exists in `.git/hooks`\n  * file `.git/hooks/` is updated\n\n## Usage\n\nrun `git hooks` to show detected hooks in your configured `templatedir` as well\nas the help menu.\n\n```bash\nGIT HOOKS\n  A custom git command to manage a git repository hooks.\n  See https://github.com/archf/git-hooks.\n\nUSAGE\n  git hooks [OPTIONS] CMD\n\nOPTIONS\n  -h|--help   Show this help menu.\n  -f|--force  Force hook update.\n\nCMD\n  show        List git 'templatedir' available hooks.\n  install     Install hooks found inside git 'templatedir' in repository.\n              Current hooks are backed up to '.git/hooks.old'. If the hook is\n              already found in '.git/hooks.old' it will be skipped unless you\n              delete it manually or use the --force option.\n  restore     Restore previous set of hooks from '.git/hooks.old'.\n  help        Show this help menu.\n```\n\n## FAQ\n\nHow to locate your current 'templatedir'?\n\n```bash\ngit config --global init.templatedir\n```\n\n# Installation\n\nClone this repository somewhere and put this script in your PATH.\n\n```bash\ngit clone git@github.com:archf/git-hooks.git\n```\n\nPersonally I like to install those kind of scripts in\n`~/bin` whilst `~/bin` is in your PATH.\n\nQuickly add a symlink in `~/bin`:\n\n```bash\nmake install\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farchf%2Fgit-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farchf%2Fgit-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farchf%2Fgit-hooks/lists"}