{"id":13602124,"url":"https://github.com/qoomon/git-conventional-commits","last_synced_at":"2025-04-09T23:15:33.573Z","repository":{"id":35134288,"uuid":"211104916","full_name":"qoomon/git-conventional-commits","owner":"qoomon","description":"Git Conventional Commits Util to generate Semantic Version and Markdown Change Log and Validate Commit Messag","archived":false,"fork":false,"pushed_at":"2025-03-31T10:15:58.000Z","size":734,"stargazers_count":470,"open_issues_count":5,"forks_count":47,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-09T23:15:26.424Z","etag":null,"topics":["changelog","commit-message","configure","conventional-commits","generator","git","git-hooks","repository","verify"],"latest_commit_sha":null,"homepage":"https://short.qoo.monster/git-cc","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qoomon.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}},"created_at":"2019-09-26T14:09:22.000Z","updated_at":"2025-04-09T09:18:23.000Z","dependencies_parsed_at":"2024-03-26T11:47:39.335Z","dependency_job_id":null,"html_url":"https://github.com/qoomon/git-conventional-commits","commit_stats":{"total_commits":149,"total_committers":11,"mean_commits":"13.545454545454545","dds":"0.24161073825503354","last_synced_commit":"5901fc553adcc746fe85040875f28cdeda89b90a"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qoomon%2Fgit-conventional-commits","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qoomon%2Fgit-conventional-commits/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qoomon%2Fgit-conventional-commits/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qoomon%2Fgit-conventional-commits/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qoomon","download_url":"https://codeload.github.com/qoomon/git-conventional-commits/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125592,"owners_count":21051770,"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":["changelog","commit-message","configure","conventional-commits","generator","git","git-hooks","repository","verify"],"created_at":"2024-08-01T18:01:14.640Z","updated_at":"2025-04-09T23:15:33.553Z","avatar_url":"https://github.com/qoomon.png","language":"JavaScript","readme":"# Git Conventional Commits [![starline](https://starlines.qoo.monster/assets/qoomon/git-conventional-commits)](https://github.com/qoomon/starlines)\n\n[![npm](https://img.shields.io/npm/v/git-conventional-commits)](https://www.npmjs.com/package/git-conventional-commits)\n\n\u003e [!TIP]\n\u003e Also have a look at **[Git Conventional Commits Cheat Sheet](https://gist.github.com/qoomon/5dfcdf8eec66a051ecd85625518cfd13)**\n\n### Changelog\nsee [CHANGELOG.md](CHANGELOG.md)\n\n### Usage\n`npx git-conventional-commits \u003ccommand\u003e`\n#### Commands\nℹ add help parameter `-h` to commands to list all possible options\n```\n  init [options]                               create a config file template `git-conventional-commits.yaml`\n  version [options]                            determine version from conventional commits\n  changelog [options]                          generate change log from conventional commits\n  commit-msg-hook [options] \u003ccommit-msg-file\u003e  check for conventional commit message format\n```\n  \n#### First Usage\n* Run `npx git-conventional-commits init`\n* Adjust [config file](#config-file) `git-conventional-commits.yaml` to your needs\n\n#### Config File\nExample `git-conventional-commits.yaml`\n```yaml\n---\nconvention:\n  commitTypes:\n  - feat     # Commits, that add or remove a new feature to the API or UI\n  - fix      # Commits, that fix a API or UI bug of a preceded feat commit\n  - refactor # Commits, that rewrite/restructure your code, however do not change any API or UI behaviour\n  - perf     # Commits are special `refactor` commits, that improve performance\n  - style    # Commits, that do not affect the meaning (white-space, formatting, missing semi-colons, etc)\n  - test     # Commits, that add missing tests or correcting existing tests\n  - build    # Commits, that affect build components like build tool, ci pipeline, dependencies, project version, ...\n  - ops      # Commits, that affect operational components like infrastructure, deployment, backup, recovery, ...\n  - docs     # Commits, that affect documentation only \n  - chore    # Miscellaneous commits e.g. modifying `.gitignore`\n  - docs\n  - merge\n  commitScopes: []\n  releaseTagGlobPattern: v[0-9]*.[0-9]*.[0-9]*\nchangelog:\n  commitTypes:\n  - feat\n  - fix\n  - perf\n  - merge\n  includeInvalidCommits: true\n  commitScopes: []\n  commitIgnoreRegexPattern: \"^WIP \"\n  headlines:\n    feat: Features\n    fix: Bug Fixes\n    perf: Performance Improvements\n    merge: Merges\n    breakingChange: BREAKING CHANGES\n  commitUrl: https://github.com/qoomon/git-conventional-commits/commit/%commit%\n  commitRangeUrl: https://github.com/qoomon/git-conventional-commits/compare/%from%...%to%?diff=split\n  issueRegexPattern: \"#[0-9]+\"\n  issueUrl: https://github.com/qoomon/git-conventional-commits/issues/%issue%\n\n```\n* `convention`\n  * `commitTypes` an array of expected commit types\n    * show warnings for unexpected types\n    * if not set or empty commit type validation is disabled\n    * e.g. `[\"feat\", \"fix\", \"doc\", \"style\"]`\n  * `commitScopes` an array of expected commit types\n    * show warnings for unexpected scopes\n    * if not set or empty commit scope validation is disabled\n    * e.g. `[\"ui\", \"database\"]` \n  * `releaseTagGlobPattern` glob pattern to filter for release tags\n    * release tags must contain semantic version (`[0-9]+\\.[0-9]+\\.[0-9]+`)\n    * default `*`  \n  * `issueRegexPattern` regex pattern to find issue IDs\n    * e.g. Jira issue pattern `[A-Z]{3,}-\\\\d+`\n \n* `changelog` \n  * `commitTypes` filter commits by type\n    * a subset of `convention.commitTypes` plus\n      * `merge` commits\n    * if not set or empty commit type filter is disabled\n    * e.g. `[\"feat\", \"fix\", \"merge\"]`\n  * `commitScopes` filter commits by scopes\n    * a subset of `convention.commitScopes`\n    * if not set or empty commit scope filter is disabled\n    * e.g. `[\"ui\"]`\n  * `includeInvalidCommits` include commits without valid type: default: `true`\n    * if set to false all commits with undefined `commitTypes` will be removed from changelog \n  * `commitIgnoreRegexPattern` filter commits by commit subject regex\n    * default `^WIP `  \n  * `headlines` a map of headline identifier and actual headline\n    * a subset of `changelog.commitTypes` plus\n      * `breakingChange` Breaking Changes Section\n    * e.g. `{ \"feat\": \"Features\", \"fix\": \"Bug Fixes\", \"breakingChange\": \"BREAKING CHANGES\"}`  \n    * default `{ \"feat\": \"Features\", \"fix\": \"Bug Fixes\", \"merge\": \"Merges\", \"breakingChange\": \"BREAKING CHANGES\"}`\n  * `commitUrl` an URL template for generating markdown links to repository commits\n    * `%commit%` commit hash placeholder\n    * eg `https://github.com/qoomon/git-conventional-commits/commit/%commit%`\n    * if not set or empty link generation is disabled\n  * `issueUrl` an URL template for generating markdown links to an issue tracker\n    * `%issue%` issue id placeholder\n    * eg `https://jira.example.org/browse/%issue%`\n    * if not set or empty link generation is disabled\n \n\n### Automatically Validate Commit Message Convention before Commit\n\nTo automatically validate commit messages, a git hook can be used in the `commit-msg` stage. \nThe hook can be created either manually or using the [pre-commit framework](https://pre-commit.com/).\n\n#### Setup with the pre-commit framework\n* Create `.pre-commit-config.yaml` file in the root directory of your repository with following content. \n    ```yaml\n    repos:\n    - repo: https://github.com/qoomon/git-conventional-commits\n      rev: \u003cRELEASE_TAG\u003e\n      hooks:\n        - id: conventional-commits\n    ```\n* Install the `pre-commit` framework `pip install pre-commit`\n* Install the commit-msg hook `pre-commit install -t commit-msg`\n\n#### Setup manually\n* Setup Commit Message Hook to \n  * Navigate to your repository directory `cd \u003crepository-path\u003e`\n  * Create git hook directory `mkdir .git-hooks`\n  * Set update hooksPath `git config core.hooksPath .git-hooks`\n  * Create commit message hook script and make it executable\n    * `touch .git-hooks/commit-msg \u0026\u0026 chmod +x .git-hooks/commit-msg`\n    * Open `.git-hooks/commit-msg` with your favorite editor and paste following script\n      ```shell\n      #!/bin/sh\n\n      # fix for windows systems\n      PATH=\"/c/Program Files/nodejs:$HOME/AppData/Roaming/npm/:$PATH\"\n\n      npx git-conventional-commits commit-msg-hook \"$1\"\n      ```\n  * Add and commit `.git-hooks/commit-msg` to repository\n\u003e [!IMPORTANT]\n\u003e Whenever you clone your repository with git hooks you need to enable git hooks once again\n\u003e \u003cbr\u003e`git config core.hooksPath .git-hooks`\n\n\n### Release Workflow with `git-conventional-commits`\n* Determine version by `npx git-conventional-commits version`\n* Update version in project files\n  * Commit version bump `git commit -am'build(release): bump project version to \u003cversion\u003e'`\n* Generate change log by `npx git-conventional-commits changelog --release  \u003cversion\u003e --file 'CHANGELOG.md'`\n  * Commit change log `git commit -am'docs(release): create \u003cversion\u003e change log entry'`\n* Tag commit with version `git tag -a -m'build(release): \u003cversion\u003e' '\u003cversion-prefix\u003e\u003cversion\u003e'`\n* Push all changes `git push`\n* Build and upload artifacts\n\n### Integration with existing repository\n\nIf you have an large existing repo with no release tags e.g. v1.0.0, or if you want the first changelog to be tidy, you need to create a release tag first.\n* Create release tag for specific commit`git tag -a -m'build(release): 0.0.0' 'v0.0.0'`\n* Push tag `git push origin v0.0.0`\nThis way `npx git-conventional-commits` will only considre commits based on the commit the release tag is pointing at.\n\n---\n## Projects Using git-conventional-commits\n- https://github.com/Blazity/next-enterprise\n\n---\n\n## Build/Release\n* `npm install`\n* `npm test`\n* `npm login`\n* `npm publish`\n\n","funding_links":[],"categories":["JavaScript","git"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqoomon%2Fgit-conventional-commits","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqoomon%2Fgit-conventional-commits","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqoomon%2Fgit-conventional-commits/lists"}