Skip to content

Commit ab51bc7

Browse files
committed
docs(retry): Updated docs to show ways to run --retry
There are multiple ways to pass the --retry option to a npm script. This change updates the docs to explain some of them. references #132
1 parent 26fbf40 commit ab51bc7

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ npm install -g commitizen
1212
```
1313

1414
#### Using the command line tool
15-
Now, simply use `git cz` instead of `git commit` when committing.
15+
Now, simply use `git cz` instead of `git commit` when committing.
1616

17-
When you're working in a Commitizen friendly repository, you'll be prompted to fill in any required fields and your commit messages will be formatted according to the standards defined by project maintainers.
17+
When you're working in a Commitizen friendly repository, you'll be prompted to fill in any required fields and your commit messages will be formatted according to the standards defined by project maintainers.
1818

1919
[![Add and commit with Commitizen](https://github.com/commitizen/cz-cli/raw/master/meta/screenshots/add-commit.png)](https://github.com/commitizen/cz-cli/raw/master/meta/screenshots/add-commit.png)
2020

2121
If you're not working in a Commitizen friendly repository, then `git cz` will work just the same as `git commit`.
2222

2323
### Commitizen for project maintainers
24-
As a project maintainer, making your repo Commitizen friendly allows you to select pre-existing commit message conventions or to create your own custom commit message convention. When a contributor to your repo uses Commitizen, they will be prompted for the correct fields at commit time.
24+
As a project maintainer, making your repo Commitizen friendly allows you to select pre-existing commit message conventions or to create your own custom commit message convention. When a contributor to your repo uses Commitizen, they will be prompted for the correct fields at commit time.
2525

2626
#### Making your repo Commitizen-friendly
2727

@@ -84,10 +84,17 @@ Commitizen is great on its own, but it shines when you use it with some other am
8484

8585
#### Retrying failed commits
8686

87-
As of version 2.7.1, you may attempt to retry the last commit using the `git cz --retry` command. This can be helpful when you have tests set up to run via a git precommit hook. In this scenario, you may have attempted a Commitizen commit, painstakingly filled out all of the commitizen fields, but your tests fail. In previous Commitizen versions, after fixing your tests, you would be forced to fill out all of the fields again. Enter the retry command. Commitizen will retry the last commit that you attempted in this repo without you needing to fill out the fields again.
87+
As of version 2.7.1, you may attempt to retry the last commit using the `git cz --retry` command. This can be helpful when you have tests set up to run via a git precommit hook. In this scenario, you may have attempted a Commitizen commit, painstakingly filled out all of the commitizen fields, but your tests fail. In previous Commitizen versions, after fixing your tests, you would be forced to fill out all of the fields again. Enter the retry command. Commitizen will retry the last commit that you attempted in this repo without you needing to fill out the fields again.
8888

8989
Please note that the retry cache may be cleared when upgrading commitizen versions, upgrading adapters, or if you delete the `commitizen.json` file in your home or temp directory. Additionally, the commit cache uses the filesystem path of the repo, so if you move a repo or change its path, you will not be able to retry a commit. This is an edge case, but might be confusing if you have scenarios where you are moving folders that contain repos.
9090

91+
It is important to note that if you are running `git-cz` from a npm script (let's say it is called `commit`) you will need to do one of the following:
92+
- Pass `-- --retry` as an argument for your script. i.e: `npm run commit -- --retry`
93+
- Use [npm-run](https://www.npmjs.com/package/npm-run) to find and call git-cz executable directly. i.e: `npm-run git-cz --retry`
94+
- Use [npm-quick-run](https://www.npmjs.com/package/npm-quick-run) i.e: `nr commit --retry` or just `nr c --retry` (which will run all scripts that starts with the letter 'c')
95+
96+
Note that the last two options **do not** require you to pass `--` before the args but the first **does**.
97+
9198
### Adapters
9299

93100
We know that every project and build process has different requirements so we've tried to keep Commitizen open for extension. You can do this by choosing from any of the pre-build adapters or even by building your own. Here are some of the great adapters available to you:
@@ -117,4 +124,3 @@ We accomplish this by letting you define which adapter you'd like to use in your
117124
@Den-dp
118125

119126
Special thanks to @stevelacy, whose [gulp-git](https://www.npmjs.com/package/gulp-git) project makes commitizen possible.
120-

0 commit comments

Comments
 (0)