{"id":14069755,"url":"https://github.com/jaspernbrouwer/git-flow-hooks","last_synced_at":"2025-07-10T20:07:56.415Z","repository":{"id":46761486,"uuid":"12975249","full_name":"jaspernbrouwer/git-flow-hooks","owner":"jaspernbrouwer","description":"Some useful hooks for git-flow (AVH Edition)","archived":false,"fork":false,"pushed_at":"2018-11-15T09:45:47.000Z","size":105,"stargazers_count":155,"open_issues_count":4,"forks_count":50,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-05T04:31:45.226Z","etag":null,"topics":[],"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/jaspernbrouwer.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-20T14:19:13.000Z","updated_at":"2025-03-28T17:18:21.000Z","dependencies_parsed_at":"2022-09-23T03:51:36.524Z","dependency_job_id":null,"html_url":"https://github.com/jaspernbrouwer/git-flow-hooks","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/jaspernbrouwer/git-flow-hooks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaspernbrouwer%2Fgit-flow-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaspernbrouwer%2Fgit-flow-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaspernbrouwer%2Fgit-flow-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaspernbrouwer%2Fgit-flow-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaspernbrouwer","download_url":"https://codeload.github.com/jaspernbrouwer/git-flow-hooks/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaspernbrouwer%2Fgit-flow-hooks/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264647485,"owners_count":23643651,"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-08-13T07:07:11.806Z","updated_at":"2025-07-10T20:07:56.160Z","avatar_url":"https://github.com/jaspernbrouwer.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"git-flow-hooks\n==============\n\nSome useful hooks for [git-flow (AVH Edition)][1].\n\nWhat does it do?\n================\n\n- Prevent direct commits to the master branch.\n- Prevent merge marker commits.\n- Automatically bump versions when starting a release or hotfix. Versions are generated, written to file and committed.\n- Automatically specify tag messages.\n\nUsage\n=====\n\nInstall\n-------\n\nClone this repository somewhere on your disk.\n\n```sh\ngit clone git@github.com:jaspernbrouwer/git-flow-hooks.git\n```\n\nWhenever your read `/path/to/git-flow-hooks`, replace it with the actual path to your clone/working copy.\n\n### OS X\n\nOS X doesn't support `sort -V`, which is used to sort git tags by version number, which in turn is needed to correctly bump versions.\n\nOn OS X you can install [coreutils][6] (using [MacPorts][7] or [Homebrew][8]), after which `gsort -V` can be used.\nIf it's located at `/opt/local/bin/gsort` or `/usr/local/bin/gsort` we will pick it up automatically.\nOtherwise we fall back to `/usr/bin/sort`.\n\nOptionally you can use the configuration option `VERSION_SORT` to point to a different command.\n\nActivate\n--------\n\nInitialize git-flow.\n\n```sh\ngit flow init\n```\n\nIt will ask you some questions, the last will be `Hooks and filters directory?`, which you can answer with `/path/to/git-flow-hooks`.\n\nIf you've already initialized git-flow, you can still set/change the path manually.\n\n```sh\ngit config gitflow.path.hooks /path/to/git-flow-hooks\n```\n\n### Prevention hooks\n\nThe hooks that prevent direct commits to the master branch, and prevent merge marker commits, are `pre-commit` hooks.\n\nThese only function if they're located in the `.git/hooks` directory of your working copy.\nIn other words, after activating like described above, these hooks still won't kick in.\n\nI see 2 options:\n\n1. In stead of activating like described above, remove the `.git/hooks` directory and make it a symbolic link (`ln -s /path/to/git-flow-hooks .git/hooks`).\n2. Create a symbolic link to the `pre-commit` file (`ln -s /path/to/git-flow-hooks/pre-commit .git/hooks/pre-commit`).\n\nIf you know a better way to use the `pre-commit` hooks, please let me know by opening an issue!\n\nUpdate\n------\n\nSimply pull any updates from origin.\n\n```sh\ncd /path/to/git-flow-hooks\ngit pull\n```\n\nThat's it, all your repositories that have git-flow initialized and use `/path/to/git-flow-hooks` as hooks and filters directory will be up-to-date.\n\nConfiguration\n-------------\n\nThis is completely optional!\n\n#### Global\n\nCopy the file `/path/to/git-flow-hooks/modules/git-flow-hooks-config.sh.dist` to `/path/to/git-flow-hooks/git-flow-hooks-config.sh` (hooks directory) and change whatever you like.\n\n#### Local\n\nCopy the file `/path/to/git-flow-hooks/modules/git-flow-hooks-config.sh.dist` to `.git/git-flow-hooks-config.sh` (repository root) and change whatever you like.\n\nAny settings in the local configuration file will override settings in the global one. So remove settings you _don't_ want to override.\n\n#### git-flow\n\n[git-flow (AVH Edition)][1] has some useful configuration options too.\nSee its [wiki][5] for a complete list.\nOr you can type `git flow \u003ccommand\u003e [\u003csubcommand\u003e] --help`.\n\nStarting releases and hotfixes\n------------------------------\n\nIf `git flow release start` and `git flow hotfix start` are run without a version, the version will be bumped automatically.\nReleases will be bumped at the minor level (`1.2.3` becomes `1.3.0`), hotfixes at the patch level (`1.2.3` becomes `1.2.4`).\nThe hooks will look at the git tags to find the version to bump.\nIf no tags are found, it looks for the version-file.\nIf that isn't found, it assumes the current version is `0.0.0`.\n\nAlternatively you may use `patch`, `minor` and `major` as version.\nA bump of that level will take place.\n\nIf the commands are run with version, that version will be used (no bumping).\n\nBump messages\n-------------\n\ngit-flow-hooks bumps the version in a commit with the message \"Bump version to %version%\".\n\nIf you want to use a different message, you can change it in the git-flow-hooks configuration.\n\nAutomatic tag messages\n----------------------\n\nIf you want tag messages to be automated (you won't be bothered with your editor to specify it), use the following configuration options:\n\n```sh\ngit config gitflow.hotfix.finish.message \"Hotfix %tag%\"\ngit config gitflow.release.finish.message \"Release %tag%\"\n```\n\nIf you like, you can change the tag-placeholder (`%tag%` in the example above) in the git-flow-hooks configuration.\n\nPlugins\n-------\n\nWe want to create a plugin-like structure where users can add functionality in a more uniform way.\nUnfortunately, that would take some time and testing to implement.\n\nWhile it's in progress, you can try to use the following forks:\n\n* [Send notifications with changelog to Slack and HipChat](https://github.com/exAspArk/git-flow-hooks/tree/notify#sending-notifications) ([diff](https://github.com/jaspernbrouwer/git-flow-hooks/compare/master...exAspArk:notify))\n\nLicense\n=======\n\ngit-flow-hooks is published under The MIT License, see the [LICENSE][2] file.\n\nNote that these hooks are built for [git-flow (AVH Edition)][1] by Peter van der Does, which has its own [licenses][3].\n\nThe scripts for preventing master and merge marker commits are based on [git-hooks][4] by Sitebase.\n\n[1]: https://github.com/petervanderdoes/gitflow\n[2]: https://github.com/jaspernbrouwer/git-flow-hooks/blob/master/LICENSE\n[3]: https://github.com/petervanderdoes/gitflow/blob/master/LICENSE\n[4]: https://github.com/Sitebase/git-hooks\n[5]: https://github.com/petervanderdoes/gitflow/wiki/Reference:-Configuration\n[6]: http://www.gnu.org/software/coreutils\n[7]: http://www.macports.org/\n[8]: http://brew.sh/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaspernbrouwer%2Fgit-flow-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaspernbrouwer%2Fgit-flow-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaspernbrouwer%2Fgit-flow-hooks/lists"}