Title: Filtering commits by path before version bump · Issue #1347 · commitizen-tools/commitizen · GitHub
Open Graph Title: Filtering commits by path before version bump · Issue #1347 · commitizen-tools/commitizen
X Title: Filtering commits by path before version bump · Issue #1347 · commitizen-tools/commitizen
Description: Description Introduce an option (either in the configuration file or as a CLI argument) to filter the commits that will be considered for the version bump calculation. This feature would allow users to specify a path prefix, ensuring tha...
Open Graph Description: Description Introduce an option (either in the configuration file or as a CLI argument) to filter the commits that will be considered for the version bump calculation. This feature would allow user...
X Description: Description Introduce an option (either in the configuration file or as a CLI argument) to filter the commits that will be considered for the version bump calculation. This feature would allow user...
Opengraph URL: https://github.com/commitizen-tools/commitizen/issues/1347
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Filtering commits by path before version bump","articleBody":"### Description\n\nIntroduce an option (either in the configuration file or as a CLI argument) to filter the commits that will be considered for the version bump calculation. This feature would allow users to specify a path prefix, ensuring that only commits affecting files within the specified path are taken into account.\n\nThis feature would provide a basic way to handle version bumping in monorepos by allowing users to focus on changes within specific subdirectories and could be used by users until full support for monorepos is added to commitizen (I saw other issues mentioning other types of features for monorepo support so this could be used together with those other features).\n\n### Possible Solution\n\nI went ahead and tried implementing my suggestion [in a fork](https://github.com/dalbitresb12/commitizen/tree/feat/bump-path-filter) so that I could start testing it with an internal application (I did search for contributing guidelines, but I didn't look in the docs/ folder, so I didn't see [this line](https://github.com/commitizen-tools/commitizen/blob/5d6369ee1c6e06f610f5a77117df909cee389b64/docs/contributing.md?plain=1#L5) before implementing, sorry).\n\nBasically the changes I made are:\n\n- [Read a new config option, `path_prefix`](https://github.com/dalbitresb12/commitizen/blob/3cce09866984de070a2b854922fc9433a1641abf/commitizen/commands/bump.py#L69). I didn't add this feature as a CLI argument but it can be added if wanted.\n- Use this config option to [apply a filter](https://github.com/dalbitresb12/commitizen/blob/3cce09866984de070a2b854922fc9433a1641abf/commitizen/commands/bump.py#L139-L150) using the already implemented [`git.get_filenames_in_commit`](https://github.com/commitizen-tools/commitizen/blob/08a259d2de99138035c08af35ec515fb8455aa83/commitizen/git.py#L153-L164) function.\n- [Filter the list of commits](https://github.com/dalbitresb12/commitizen/blob/3cce09866984de070a2b854922fc9433a1641abf/commitizen/commands/bump.py#L267) using the previously defined filter.\n\nI can make a PR for this feature and also make any other changes as needed so that this feature can see the light of day :)\n\n### Additional context\n\nYou can see the [test](https://github.com/dalbitresb12/commitizen/blob/3cce09866984de070a2b854922fc9433a1641abf/tests/commands/test_bump_command.py#L1548-L1562) I implemented for an example of the feature working.\n\n### Additional context\n\n_No response_","author":{"url":"https://github.com/dalbitresb12","@type":"Person","name":"dalbitresb12"},"datePublished":"2025-01-30T18:00:47.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1347/commitizen/issues/1347"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4c349451-a907-deb3-4ff8-88406d58e3b6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ACE6:8CA80:803338:B3FAD9:6A4E7C72 |
| html-safe-nonce | 50c8140271bb2cea22df4d0ec8b159d4e3d6b9a122d9c567d2cc3534b3797805 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQ0U2OjhDQTgwOjgwMzMzODpCM0ZBRDk6NkE0RTdDNzIiLCJ2aXNpdG9yX2lkIjoiNDMyNTkwNjMyNTUwMDM4NjQyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | e4ce7e06076c2d9d647a39a0e846b83545453b38986da38c1f1ce4912568c7aa |
| hovercard-subject-tag | issue:2821482432 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/commitizen-tools/commitizen/1347/issue_layout |
| twitter:image | https://opengraph.githubassets.com/042b7decd32cf7f211e875f858e1e8a74ada118c8139bdc688dc4780d04c7a3d/commitizen-tools/commitizen/issues/1347 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/042b7decd32cf7f211e875f858e1e8a74ada118c8139bdc688dc4780d04c7a3d/commitizen-tools/commitizen/issues/1347 |
| og:image:alt | Description Introduce an option (either in the configuration file or as a CLI argument) to filter the commits that will be considered for the version bump calculation. This feature would allow user... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dalbitresb12 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 41b6ab3ba6d20a71766ac245b5a4a94c6fc672a9cd4da7d44c1b33ab8bf6a21c |
| turbo-cache-control | no-preview |
| go-import | github.com/commitizen-tools/commitizen git https://github.com/commitizen-tools/commitizen.git |
| octolytics-dimension-user_id | 62252524 |
| octolytics-dimension-user_login | commitizen-tools |
| octolytics-dimension-repository_id | 106127589 |
| octolytics-dimension-repository_nwo | commitizen-tools/commitizen |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 106127589 |
| octolytics-dimension-repository_network_root_nwo | commitizen-tools/commitizen |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e6a744804e8e70f97b4d5a18a94dcc63db22f97a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width