{"id":22221239,"url":"https://github.com/victorbadaro/automatic-conventional-commits-example","last_synced_at":"2026-05-02T14:41:06.742Z","repository":{"id":206460659,"uuid":"716638382","full_name":"victorbadaro/automatic-conventional-commits-example","owner":"victorbadaro","description":"An example of how to set a repo to use conventional commits automatically","archived":false,"fork":false,"pushed_at":"2023-11-11T17:30:25.000Z","size":45,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-30T07:13:49.468Z","etag":null,"topics":["commit-msg","commitizen","commitlint","conventional-changelog","conventional-commits","git","husky","prepare-commit-msg"],"latest_commit_sha":null,"homepage":"https://github.com/victorbadaro/automatic-conventional-commits-example#readme","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/victorbadaro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-11-09T14:57:15.000Z","updated_at":"2023-11-09T18:22:11.000Z","dependencies_parsed_at":"2024-12-03T03:03:51.844Z","dependency_job_id":null,"html_url":"https://github.com/victorbadaro/automatic-conventional-commits-example","commit_stats":null,"previous_names":["victorbadaro/automatic-conventional-commits-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorbadaro%2Fautomatic-conventional-commits-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorbadaro%2Fautomatic-conventional-commits-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorbadaro%2Fautomatic-conventional-commits-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorbadaro%2Fautomatic-conventional-commits-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/victorbadaro","download_url":"https://codeload.github.com/victorbadaro/automatic-conventional-commits-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245422921,"owners_count":20612725,"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":["commit-msg","commitizen","commitlint","conventional-changelog","conventional-commits","git","husky","prepare-commit-msg"],"created_at":"2024-12-02T23:12:48.324Z","updated_at":"2026-05-02T14:41:01.718Z","avatar_url":"https://github.com/victorbadaro.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# automatic-conventional-commits-example\n[![image](https://img.shields.io/badge/EN-blue)](./README.md)\n[![image](https://img.shields.io/badge/PT-blue)](./LEIAME.md)\n\nThis repository serves as an example for implementing automatic [conventional commits](https://www.conventionalcommits.org/) in a project. It demonstrates how to streamline the commit message formatting and structure for better readability and automated versioning.\n\n## Prerequisites\n\nBefore you begin, ensure you have met the following requirements:\n\n1. You have created a `package.json` file for your project. If you haven't created one, you can initialize a new `package.json` file using one of the following commands:\n    ```bash\n    npm init -y\n    # or\n    yarn init -y\n    ```\n2. You have Git installed. If not, you can download it [here](https://git-scm.com/downloads).\n3. You have initialized a local Git repository. If you haven't initialized a Git repository yet, you can do so by executing the following command in your project directory:\n    ```bash\n    git init\n    ```\n\n## Configuration\nYou can adhere to a commit convention and also (if you want) add interactivity to your `git commit` command.\n\n### Adhere to a commit convention\nHere, you're gonna need some dependencies ([commitlint](https://github.com/conventional-changelog/commitlint) and [husky](https://github.com/typicode/husky)), set them up and add the `commit-msg` [hook](https://git-scm.com/docs/githooks#_commit_msg).\n\n1. Install the commitlint dependencies:\n    ```bash\n    npm install -D @commitlint/config-conventional @commitlint/cli\n    # or\n    yarn add -D @commitlint/config-conventional @commitlint/cli\n    ```\n2. Configure commitlint to use conventional config:\n    ```bash\n    echo \"module.exports = { extends: ['@commitlint/config-conventional'] };\" \u003e commitlint.config.js\n    ```\n3. Install husky:\n    ```bash\n    npm install -D husky\n    # or\n    yarn add -D husky\n    ```\n4. Activate [git hooks](https://git-scm.com/docs/githooks):\n    ```bash\n    npx husky install\n    # or\n    yarn husky install\n    ```\n5. Add the `commit-msg` hook:\n    ```bash\n    npx husky add .husky/commit-msg  'npx --no -- commitlint --edit ${1}'\n    ```\nIf you don't want to run the step 4 (`npx husky install` or `yarn husky install`) every single time you clone your repo include the `prepare` script in your `package.json` and it will be executed automatically every time you run the command to install your project's dependencies (e.g. `npm install` or `yarn`):\n```json\n\"scripts\": {\n  \"prepare\": \"husky install\" \n}\n```\n\nIf you're facing any configuration errors, check the [commitlint guide](https://commitlint.js.org/#/guides-local-setup).\u003cbr/\u003e\nIt's done! Now you can try to commit some new changes (you might want to check the conventional commits specification [here](https://www.conventionalcommits.org/)):\n```bash\ngit commit -m \"some new message\" # ❌ this will fail\ngit commit -m \"foo: some new message\" # ❌ this will fail\ngit commit -m \"feat: some new message\" # ✅ this won't fail\n```\n![image](https://github.com/victorbadaro/automatic-conventional-commits-example/assets/9096344/20cd75a6-9f71-49fd-930d-6faf0b0c6a0d)\n\n### Add interactivity to your `git commit` command\n1. Install [commitizen](https://github.com/commitizen/cz-cli):\n    ```bash\n    npm install -D commitizen\n    # or\n    yarn add -D commitizen\n    ```\n2. Make your repo commitizen friendly:\n    ```bash\n    npx commitizen init cz-conventional-changelog --save-dev --save-exact\n    # or\n    yarn commitizen init cz-conventional-changelog --yarn --dev --exact\n    ```\n3. Add the `prepare-commit-msg` [hook](https://git-scm.com/docs/githooks#_prepare_commit_msg):\n    ```bash\n    npx husky add .husky/prepare-commit-msg  'exec \u003c /dev/tty \u0026\u0026 node_modules/.bin/cz --hook || true'\n    ```\nhttps://github-production-user-asset-6210df.s3.amazonaws.com/9096344/281865977-82a54c18-9dd3-4a42-af80-056a0631fa61.mp4","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictorbadaro%2Fautomatic-conventional-commits-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvictorbadaro%2Fautomatic-conventional-commits-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictorbadaro%2Fautomatic-conventional-commits-example/lists"}