You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-11
Original file line number
Diff line number
Diff line change
@@ -22,20 +22,20 @@ npm install -g commitizen
22
22
23
23
### If your repo is [Commitizen-friendly]:
24
24
25
-
Simply use `git cz` instead of `git commit` when committing.
25
+
Simply use `git cz`or just `cz`instead of `git commit` when committing. You can also use `git-cz`, which is an alias for `cz`.
26
26
27
27
_Alternatively_, if you are using **NPM 5.2+** you can [use `npx`](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) instead of installing globally:
28
28
29
29
```
30
-
npx git-cz
30
+
npx cz
31
31
```
32
32
33
33
or as an npm script:
34
34
35
35
```json
36
36
...
37
37
"scripts": {
38
-
"commit": "npx git-cz"
38
+
"commit": "cz"
39
39
}
40
40
```
41
41
@@ -45,7 +45,7 @@ When you're working in a Commitizen friendly repository, you'll be prompted to f
45
45
46
46
### If your repo is NOT Commitizen friendly:
47
47
48
-
If you're **not** working in a Commitizen friendly repository, then `git cz` will work just the same as `git commit` but `npx git-cz` will use the [streamich/git-cz](https://github.com/streamich/git-cz) adapter. To fix this, you need to first [make your repo Commitizen-friendly](#making-your-repo-commitizen-friendly)
48
+
If you're **not** working in a Commitizen friendly repository, then `git cz` will work just the same as `git commit` but `npx cz` will use the [streamich/git-cz](https://github.com/streamich/git-cz) adapter. To fix this, you need to first [make your repo Commitizen-friendly](#making-your-repo-commitizen-friendly)
49
49
50
50
## Making your repo Commitizen-friendly
51
51
@@ -118,7 +118,7 @@ On **NPM 5.2+** you can [use `npx`](https://medium.com/@maybekatz/introducing-np
For **previous versions of NPM (< 5.2)** you can execute `./node_modules/.bin/commitizen` or `./node_modules/.bin/git-cz` in order to actually use the commands.
121
+
For **previous versions of NPM (< 5.2)** you can execute `./node_modules/.bin/commitizen` or `./node_modules/.bin/cz` in order to actually use the commands.
122
122
123
123
You can then initialize the conventional changelog adapter using: `./node_modules/.bin/commitizen init cz-conventional-changelog --save-dev --save-exact`
124
124
@@ -127,13 +127,15 @@ And you can then add some nice npm run scripts in your package.json pointing to
127
127
```json
128
128
...
129
129
"scripts": {
130
-
"commit": "git-cz"
130
+
"commit": "cz"
131
131
}
132
132
```
133
133
134
134
This will be more convenient for your users because then if they want to do a commit, all they need to do is run `npm run commit` and they will get the prompts needed to start a commit!
135
135
136
-
> **NOTE:** if you are using `precommit` hooks thanks to something like `husky`, you will need to name your script some thing other than "commit" (e.g. "cm": "git-cz"). The reason is because npm-scripts has a "feature" where it automatically runs scripts with the name _prexxx_ where _xxx_ is the name of another script. In essence, npm and husky will run "precommit" scripts twice if you name the script "commit," and the work around is to prevent the npm-triggered _precommit_ script.
136
+
> **NOTE:** if you are using `precommit` hooks thanks to something like [`husky`](https://www.npmjs.com/package/husky), you will need to name your script some thing other than `"commit"`
137
+
> (e.g. `"cm": "cz"`). The reason is because npm-scripts has a "feature" where it automatically runs scripts with the name _prexxx_ where _xxx_ is the name of another script. In essence,
138
+
> npm and husky will run `"precommit"` scripts twice if you name the script `"commit"`, and the work around is to prevent the npm-triggered _precommit_ script.
137
139
138
140
#### Optional: Running Commitizen on `git commit`
139
141
@@ -150,7 +152,7 @@ Update `.git/hooks/prepare-commit-msg` with the following code:
@@ -283,11 +285,10 @@ As of version 2.7.1, you may attempt to retry the last commit using the `git cz
283
285
284
286
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.
285
287
286
-
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:
288
+
It is important to note that if you are running `cz` from a npm script (let's say it is called `commit`) you will need to do one of the following:
287
289
288
290
- Pass `-- --retry` as an argument for your script. i.e: `npm run commit -- --retry`
289
-
- 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`
290
-
- 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')
291
+
- Use [npx](https://www.npmjs.com/package/npx) to find and call `cz` executable directly. i.e: `npx cz --retry`
291
292
292
293
Note that the last two options **do not** require you to pass `--` before the args but the first **does**.
0 commit comments