{"id":13632523,"url":"https://github.com/jevakallio/git-notify","last_synced_at":"2025-12-29T23:20:48.786Z","repository":{"id":48173242,"uuid":"343152432","full_name":"jevakallio/git-notify","owner":"jevakallio","description":"🙉 📣 Communicate important updates to your team via git commit messages","archived":false,"fork":false,"pushed_at":"2022-06-02T18:45:09.000Z","size":730,"stargazers_count":1347,"open_issues_count":4,"forks_count":23,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-08-10T07:53:10.102Z","etag":null,"topics":["developer-tools","git","githooks","husky","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/jevakallio.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":"2021-02-28T16:25:03.000Z","updated_at":"2024-05-01T10:54:34.000Z","dependencies_parsed_at":"2022-07-22T21:17:28.908Z","dependency_job_id":null,"html_url":"https://github.com/jevakallio/git-notify","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jevakallio%2Fgit-notify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jevakallio%2Fgit-notify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jevakallio%2Fgit-notify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jevakallio%2Fgit-notify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jevakallio","download_url":"https://codeload.github.com/jevakallio/git-notify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223772253,"owners_count":17199975,"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":["developer-tools","git","githooks","husky","typescript"],"created_at":"2024-08-01T22:03:05.751Z","updated_at":"2025-12-29T23:20:48.749Z","avatar_url":"https://github.com/jevakallio.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","GitShit","对打造产品有帮助"],"sub_categories":[],"readme":"# git-notify\n\n_Communicate important updates to your team via git commit messages_.\n\n## What is git-notify?\n\nSometimes you need to communicate changes to other developers on your project. In a small team, a Slack message works okay, but in larger teams and distributed organizations (such as open source projects), reaching everyone can be a pain.\n\n`git-notify` allows you to embed announcements into your git commit messages:\n\n```sh\ngit commit -m 'git-notify: NEW DEVELOPMENT ENVIRONMENT ...'\n```\n\nAnd display them to another developer on a machine, far far away:\n\n\u003cimg src=\"https://raw.githubusercontent.com/jevakallio/git-notify/master/docs/demo_animated.gif\" alt=\"Demo\"\u003e\u003c/img\u003e\n\nSimple as that.\n\n## How to use git-notify?\n\nJust add `\"git-notify:\"` to your git commit message, and anything that follows will be displayed when another developer pulls that commit, or switches from a branch that does not contain that commit to one that does.\n\nIf you're using a merge or squash commit strategy on GitHub, you can also add them to the extended commit message when landing a PR:\n\n\u003cimg src=\"https://github.com/jevakallio/git-notify/blob/master/docs/github-example.png?raw=true\" alt=\"GitHub PR flow example\"\u003e\u003c/img\u003e\n\n## Getting Started\n\nInstall `git-notify` to your `npm` (or `yarn`) based project as a devDependency:\n\n```bash\n# using npm\nnpm install --save-dev git-notify\n\n# using yarn\nyarn add -D git-notify\n```\n\nNext, we'll configure `git-notify` to run automatically when other developers pull commits that contain git messages. Below we show how to achieve this with the excellent [husky](https://github.com/typicode/husky) library. For other approaches, see the [Git Hooks](#git-hooks) section later in this document.\n\n### Installing hooks with husky\n\n```\n# using npm\nnpm install --save-dev husky@4\n\n# using yarn\nyarn add -D husky@4\n```\n\nConfigure `git-notify` hooks by adding the following `husky` entries to your `package.json`:\n\n```json\n{\n  //...snip\n  \"husky\": {\n    \"hooks\": {\n      \"post-merge\": \"git-notify merge $HUSKY_GIT_PARAMS\",\n      \"post-rewrite\": \"git-notify rewrite $HUSKY_GIT_PARAMS\",\n      \"post-checkout\": \"git-notify checkout $HUSKY_GIT_PARAMS\"\n    }\n  }\n}\n```\n\n_**Note:** The above instructions below are for [husky v4.x](https://github.com/typicode/husky/tree/master). Husky v5 has changed how hooks are configured, as well updated its licensing terms to be free only to other open source projects.See [husky's own documentation](https://dev.to/typicode/what-s-new-in-husky-5-32g5) for how to configure hooks in their latest version._\n\n## Configuration\n\n- `git-notify --prefix \"@everyone\"`\n  - Change the prefix `git-notify` looks for in git commit messages\n  - Default: `git-notify:`\n- `git-notify --color \"#ff6f6f\"`\n  - Change the color of the banner or message\n  - This can be one of the [`chalk` preset colors](https://www.npmjs.com/package/chalk#colors) or a hex value. Note that not all terminals support full hex color scales.\n- `git-notify --simple`\n  - Instead of a fancy banner, displays a simple text message\n\n### All parameters\n\nRun `npx git-notify --help` for an up to date list of parameters:\n\n```sh\nnpx git-notify --help\n\n  Usage\n    $ git-notify \u003cmethod\u003e [options] $GIT_PARAMS\n\n   Methods\n     since \u003ccommit\u003e  show all notifications since commit\n     merge           run on git pull/merge\n     rewrite         run on git rebase\n     checkout        run on git checkout/switch\n\n  Options\n     --prefix, -p    prefix to  look for in commit messages (default: \"git-notify:\")\n     --simple, -s    show a plain, unboxed notification\n     --color, -c     color of displayed notification\n\n  Examples\n     $ git-notify since HEAD~5\n     $ git-notify checkout $GIT_PARAMS\n```\n\n## About formatting\n\n`git-notify` will display a message for every \"git-notify:\" prefix it finds in the commit log that was just pulled/merged/rebased/checked out. **The notification message will be the rest of the paragraph following the prefix.**\n\nFor example, this commit message:\n\n```\nThis change upgrades some of our dependencies. git-notify: Please run npm install\n```\n\nWill print:\n\n```\n            ╒════════════════════════════╕\n            │                            │\n            │  Please run npm install    │\n            │                            │\n            ╘════════════════════════════╛\n```\n\nThe message will run until the end of the paragraph, delimited by a double line break. Single line breaks and other whitespace will be preserved. So that:\n\n```\nRewrite everything.\n\ngit-notify:EVERYTHING HAS CHANGED\nThis project has been rewritten\nfrom scratch. If something broke,\nplease contact Jeff at dev@null.com.\n\nMay god please forgive me.\n```\n\nWill display:\n\n```\n         ╒══════════════════════════════════════════╕\n         │                                          │\n         │          EVERYTHING HAS CHANGED          │\n         │     This project has been rewritten      │\n         │    from scratch. If something broke,     │\n         │   please contact Jeff at dev@null.com.   │\n         │                                          │\n         ╘══════════════════════════════════════════╛\n```\n\nYou can run `git-notify since` to test configuration and dry-run the message you've just created locally. For example:\n\n```\ngit commit -m '@team what's up??'\nnpx git-notify since HEAD~1 --prefix \"@team\"\n```\n\n### Can I group messages\n\nNot at the moment, but this should not be difficult to add. See [Contributing](#contributing)\n\n## Git Hooks\n\n### Installing with husky\n\nSee [Installing hooks with husky](#installing-hooks-with-husky) in the Getting Started section.\n\n### Installing hooks by any other means\n\n`git-notify` is agnostic to however you want to install your git hooks.\n\nThe hooks you need to configure are:\n\n- **post-merge** (runs on `git pull` and `git merge`)\n  - `npx git-notify merge $GIT_PARAMS`\n- **post-rewrite** (runs on `git rebase`)\n  - `npx git-notify rewrite $GIT_PARAMS`\n- **post-checkout** (runs on `git checkout` -- optional, but useful)\n  - `npx git-notify checkout $GIT_PARAMS`\n\nAt the time of writing, `git-notify checkout` is the only hook that uses the arguments (`$GIT_PARAMS`) passed to the git hook, but ideally you should always pass the arguments to `git-notify`, in case we'll need to use them in a later version.\n\nSee [githooks.com](https://githooks.com/) for more resources on the topic. Documentation for different approaches are welcome!\n\n### Installing git-notify without npm\n\nAt this time, `git-notify` is a node-based project. While I recognize it could be useful in other types of projects (ruby, python, rust, etc...), cross-platform scripting sucks, and this project is not interested in solving those problems at this time.\n\nHowever, the `git-notify` beviour has been implemented in other languages:\n\n- **PHP**: [Captain Hook](https://github.com/captainhookphp/captainhook)\n\nIf you like this idea, feel free to steal it and implement your own version, and I'll add it here.\n\n## Contributing\n\nThis project is open to contributions. For anything that would radically change the nature of the project or increase its maintenance burden, please open an issue first to discuss.\n\n### Local development\n\nThis project is written in TypeScript and scaffolded using [tsdx](https://github.com/formium/tsdx).\n\nTo run TSDX, use:\n\n```bash\nyarn start\n```\n\nThis builds to `/dist` and runs the project in watch mode so any edits you save inside `src` causes a rebuild to `/dist`.\n\nTo do a one-off build, use `npm run build` or `yarn build`.\n\nTo run tests, use `npm test` or `yarn test`.\n\n## Thanks\n\nSpecial thanks to [Sindre Sorhus](https://github.com/sindresorhus), whose excellent [meow](https://github.com/sindresorhus/meow), [boxen](https://github.com/sindresorhus/boxen) and [chalk](https://github.com/chalk/chalk) libraries make developing Node CLIs a breeze.\n\n## LICENSE\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjevakallio%2Fgit-notify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjevakallio%2Fgit-notify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjevakallio%2Fgit-notify/lists"}