{"id":21703513,"url":"https://github.com/zixia/git-scripts","last_synced_at":"2025-04-12T15:11:50.063Z","repository":{"id":42071294,"uuid":"12524252","full_name":"zixia/git-scripts","owner":"zixia","description":"Git hooks integration for Node.js projects","archived":false,"fork":false,"pushed_at":"2022-04-14T00:17:58.000Z","size":78,"stargazers_count":47,"open_issues_count":0,"forks_count":16,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-12T15:11:45.241Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/git-scripts","language":"JavaScript","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/zixia.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}},"created_at":"2013-09-01T17:37:52.000Z","updated_at":"2025-02-11T21:30:45.000Z","dependencies_parsed_at":"2022-08-12T04:01:15.031Z","dependency_job_id":null,"html_url":"https://github.com/zixia/git-scripts","commit_stats":null,"previous_names":["nkzawa/git-scripts"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zixia%2Fgit-scripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zixia%2Fgit-scripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zixia%2Fgit-scripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zixia%2Fgit-scripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zixia","download_url":"https://codeload.github.com/zixia/git-scripts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248586244,"owners_count":21128998,"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-25T21:33:07.298Z","updated_at":"2025-04-12T15:11:50.038Z","avatar_url":"https://github.com/zixia.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# git-scripts [![NPM Version](https://badge.fury.io/js/git-scripts.svg)](https://www.npmjs.com/package/git-scripts)\n\n![NPM](https://github.com/zixia/git-scripts/workflows/NPM/badge.svg)\n\nManage [git hooks](http://git-scm.com/book/en/Customizing-Git-Git-Hooks) with the \"git.scripts\" field of the package.json like [npm-scripts](https://npmjs.org/doc/scripts.html).\n\n```json\n{\n  \"name\": \"your-project\",\n  \"version\": \"0.0.0\",\n  \"description\": \"\",\n  \"devDependencies\": {\n    \"git-scripts\": \"*\"\n  },\n  \"git\": {\n    \"scripts\": {\n      \"pre-commit\": \"npm test\",\n      \"post-merge\": \"npm install\"\n    }\n  }\n}\n```\n\nSee also [this module's package.json](https://github.com/nkzawa/git-scripts/blob/master/package.json) as an example.\n\n## Installation\n    $ npm install git-scripts\n\nNOTE: `.git/hooks` of your project is replaced when installed. You can restore it by uninstalling the module.\n\n## Description\ngit-scripts supports all hooks including the following:\n\n* applypatch-msg\n* pre-applypatch\n* post-applypatch\n* pre-commit\n* prepare-commit-msg\n* commit-msg\n* post-commit\n* pre-rebase\n* post-checkout\n* post-merge\n* pre-receive\n* update\n* post-receive\n* post-update\n* pre-auto-gc\n* post-rewrite\n* pre-push\n\n## CLI\n    $ npm install -g git-scripts\n\n```\nUsage: git-scripts \u003ccommand\u003e [options]\n\n  Options:\n\n    -h, --help     output usage information\n    -V, --version  output the version number\n\n  Commands:\n\n    install [path]           install git-scripts\n    uninstall [path]         uninstall git-scripts\n    run \u003cname\u003e [args ...]    run arbitrary scripts\n```\n\nNOTE: Usually, you don't need CLI. Hooks are enabled automatically when you install the module locally.\n\n## Using Programmatically\nIf you would like to use git-scripts programmatically, you can do that.\n\n```js\nvar scripts = require('git-scripts');\nvar project = scripts('somewhere/yourproject');\n\nproject.install(function(err) {\n  if (err) throw err;\n  console.log('git-scripts was installed.');\n\n  project.run('pre-commit', function(err) {\n    if (err) throw err;\n    console.log('pre-commit script succeeded.');\n  });\n});\n```\n\n### Documentation\n```js\nvar scripts = require('git-scripts');\nvar project = scripts('somewhere/yourproject');\n```\n\n#### scripts([path])\nCreate a git-scripts instance for `path`.\n\n#### project.install([callback])\nInstall git-scripts.\n\n#### project.uninstall([callback])\nUninstall git-scripts.\n\n#### project.run(name, [args ...], [callback])\nRun an arbitrary command of `name`.\n\n## Author\n\nNaoyuki Kanezawa \u003cnaoyuki.kanezawa@gmail.com\u003e\n\n## Maintainer\n\n[Huan LI](https://github.com/huan) ([李卓桓](http://linkedin.com/in/zixia)) \u003czixia@zixia.net\u003e\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzixia%2Fgit-scripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzixia%2Fgit-scripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzixia%2Fgit-scripts/lists"}