Title: commitizen-branch - fatal: ambiguous argument '$PRE_COMMIT_FROM_REF..$PRE_COMMIT_TO_REF': unknown revision or path not in the working tree. · Issue #1912 · commitizen-tools/commitizen · GitHub
Open Graph Title: commitizen-branch - fatal: ambiguous argument '$PRE_COMMIT_FROM_REF..$PRE_COMMIT_TO_REF': unknown revision or path not in the working tree. · Issue #1912 · commitizen-tools/commitizen
X Title: commitizen-branch - fatal: ambiguous argument '$PRE_COMMIT_FROM_REF..$PRE_COMMIT_TO_REF': unknown revision or path not in the working tree. · Issue #1912 · commitizen-tools/commitizen
Description: Description After installing both commitizen hooks, I get the following error message when pushing my changes: commitizen check branch..................................................Failed - hook id: commitizen-branch - exit code: 23 f...
Open Graph Description: Description After installing both commitizen hooks, I get the following error message when pushing my changes: commitizen check branch..................................................Failed - hook...
X Description: Description After installing both commitizen hooks, I get the following error message when pushing my changes: commitizen check branch..................................................Failed - hook...
Opengraph URL: https://github.com/commitizen-tools/commitizen/issues/1912
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"commitizen-branch - fatal: ambiguous argument '$PRE_COMMIT_FROM_REF..$PRE_COMMIT_TO_REF': unknown revision or path not in the working tree.","articleBody":"### Description\n\nAfter installing both commitizen hooks, I get the following error message when pushing my changes:\n\n```sh\ncommitizen check branch..................................................Failed\n- hook id: commitizen-branch\n- exit code: 23\nfatal: ambiguous argument '$PRE_COMMIT_FROM_REF..$PRE_COMMIT_TO_REF': unknown revision or path not in the working tree.\nUse '--' to separate paths from revisions, like this:\n'git \u003ccommand\u003e [\u003crevision\u003e...] -- [\u003cfile\u003e...]'\n```\n\n### Steps to reproduce\n\n1. Create repo\n2. Install pre-commit hooks\n `pre-commit install -t pre-commit -t commit-msg -t pre-push`\n3. Push to `origin`\n\n### Current behavior\n\nAt first I thought this was because this was a brand new repo, so I pushed with `--no-verify`, but on my first PR I got the same error.\n\nMy best guess is that while `pre-commit` does use those environment variables, they are only set when `from_ref` and `to_ref` are set. See [here](https://github.com/pre-commit/pre-commit/blob/129a1f5ca1eaee0c952a5e7a07faae305c5e15bc/pre_commit/commands/run.py#L391).\n\nBut what is set on your `.pre-commit-hooks.yaml` file, is a reference to an environment variable that is not set.\n\nYou are using `args: [--rev-range, \"$PRE_COMMIT_FROM_REF..$PRE_COMMIT_TO_REF\"]`, but those variables are yet to be set.\n\nIf I use `args: [--rev-range, \"origin/main..HEAD\"]` on my `.pre-commit-config.yaml` file, it works.\n\nBut as it is right now it fails.\n\n### Desired behavior\n\nThis should succeed.\n\n### Screenshots\n\n_No response_\n\n### Environment\n\nCommitizen Version: 4.13.9\nPython Version: 3.14.3 (main, Feb 3 2026, 22:53:56) [MSC v.1944 64 bit (AMD64)]\nOperating System: Windows","author":{"url":"https://github.com/cesarcoatl","@type":"Person","name":"cesarcoatl"},"datePublished":"2026-03-24T13:42:21.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/1912/commitizen/issues/1912"}
| 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:e0e43f92-7400-4f08-e0f9-2315b643c052 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AD70:162B2:29FEAFD:3A049AF:6A4F0482 |
| html-safe-nonce | a78ba0b6da96f71c5a6514e185bd7626da71d27d49220fe82340b5a7638c737d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRDcwOjE2MkIyOjI5RkVBRkQ6M0EwNDlBRjo2QTRGMDQ4MiIsInZpc2l0b3JfaWQiOiI4OTg2NjAyNTY0NzYyOTI4MjU4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 6266f3f5430018fc1680a7db6fe74d251d14595fb17f9f0a86a70262e69edb94 |
| hovercard-subject-tag | issue:4128027706 |
| 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/1912/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9e2dc038db64458ace591ccb65fdcd7d4e1f3a95eb49ed4f998d41c1f86230de/commitizen-tools/commitizen/issues/1912 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9e2dc038db64458ace591ccb65fdcd7d4e1f3a95eb49ed4f998d41c1f86230de/commitizen-tools/commitizen/issues/1912 |
| og:image:alt | Description After installing both commitizen hooks, I get the following error message when pushing my changes: commitizen check branch..................................................Failed - hook... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | cesarcoatl |
| hostname | github.com |
| expected-hostname | github.com |
| None | b92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9 |
| 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 | 2b8f23afb982271f1b22258a94aede67a6b77760 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width