{"id":21052518,"url":"https://github.com/fwolf/git-hooks","last_synced_at":"2026-04-29T14:34:49.039Z","repository":{"id":137793817,"uuid":"100334501","full_name":"fwolf/git-hooks","owner":"fwolf","description":"Some git hooks","archived":false,"fork":false,"pushed_at":"2017-10-08T03:57:50.000Z","size":39,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-20T18:44:17.349Z","etag":null,"topics":["git","hooks","lastmodifiedtime","nutstore","sync"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/fwolf.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2017-08-15T03:26:00.000Z","updated_at":"2017-08-17T01:06:07.000Z","dependencies_parsed_at":"2023-05-22T14:00:07.863Z","dependency_job_id":null,"html_url":"https://github.com/fwolf/git-hooks","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fwolf%2Fgit-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fwolf%2Fgit-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fwolf%2Fgit-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fwolf%2Fgit-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fwolf","download_url":"https://codeload.github.com/fwolf/git-hooks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243497149,"owners_count":20300204,"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":["git","hooks","lastmodifiedtime","nutstore","sync"],"created_at":"2024-11-19T16:01:09.746Z","updated_at":"2026-04-29T14:34:49.011Z","avatar_url":"https://github.com/fwolf.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Some Git Hooks\n\n\n\n## Install, Update, Delete\n\n\n### Install\n\nCall `install.sh` in hook sub directory, eg:\n\n```bash\nsome/git/repo/dir$ path/to/git-hooks/hook-sub-dir/install.sh\n```\n\nEach install script has a hash code in it, eg:\n\n```bash\ninstallHook post-commit \"$HOOK_CONTENT\" 1l0ebpnpj11s5j5p\n```\n\nThe `1l0ebpnpj11s5j5p` is hash code, its used when update or delete hook, to\nidentify where to change in hook script.\n\n\n### Update\n\nJust run install script again.\n\nNotice hook content may have multiple lines written to hook script, if user\nchanged hook content and number of lines changed, run `install.sh` again may\naffect wrong number of rows in hook script. In this case, leave more empty lines\nin hook script, or manual delete then install again.\n\n\n### Delete\n\nYou need manual edit hook script(like `post-commit`),  find hook content by hash\ncode of the hook you want, and delete code rows.\n\n\n\n## Hooks Intro\n\n\n### auto-copyright-year\n\nAuto update copyright year when commit.\n\nNeed [copyright-year-updater.sh](https://github.com/fwolf/copyright-year-updater.sh)\nto actual do copyright year change job.\n\nConfigs stored in `update-copyright-year.php`.\n\n\n### auto-last-modified-time\n\nUpdate Last Modified Time in source code when submit.\n\nScript `update-last-modified-time.php` can use manually.\n\nUsage: Write a start date like `Last Modified: 2017-08-17` in head lines of your\ncode, the script will change it to full format, and update when hook run.\n\nConfigs stored in `update-last-modified-time.php`.\n\n__Notice for Mac OSX user__:\n\nNeed GNU `find` to work properly, install `findutils` with brew.\n\n```bash\nbrew install findutils --with-default-names\n```\n\n\n### phpcs\n\n\nCall [PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer) executable\nto check commit file, prevent commit when fail.\n\nConfigs stored in `do-phpcs.php`.\n\n\n\n### set-objects-writable\n\n\nSet all files in `.git` writable for current user.\n\nScript `find-readonly-objects.sh` can use manually to find readonly files in\n`.git`.\n\n\n\n## Customize Configuration\n\nAs hooks are mostly simple scripts, we use simple config stored in variables.\nConfigurable scripts have their default config in top lines, eg:\n\n```php\n// Config\n$phpcsPath = '/usr/local/bin/phpcs';\n$allowedExt = [\n    'php',\n];\n$codingStandard = 'psr2';\n// Other options used by phpcs\n$otherOptions = '';\n```\n\nUser can create `config.php` or `config.sh` in same directory with this script,\nand assign user config with __variable assign__ like code above, the hook script\nwill auto load user config and overwrite default config.\n\nNotice: Do NOT include `#! /usr/bin/env php` shebang in head of `config.php`.\n\n\n\n## License\n\nDistribute under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffwolf%2Fgit-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffwolf%2Fgit-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffwolf%2Fgit-hooks/lists"}