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
Since it's an adapter for Commitizen, you need to have Commitizen installed globally:
10
21
11
-
@@@
22
+
```bash
12
23
13
24
# Install Commitizen globally
14
25
@@ -17,23 +28,23 @@ npm install -g commitizen
17
28
# Install this package globally
18
29
19
30
npm install -g cleaner-commitizen-adapter
20
-
@@@
31
+
```
21
32
22
33
Commitizen does not support custom configuration via their own config file. To use this adapter you need to create a `.czrc` file in your home directory and set the path to the adapter. Edit/create the file with `vim ~/.czrc` and add the following line: `{ "path": "cleaner-commitizen-adapter" }`. This will tell Commitizen to use the custom adapter.
23
34
24
35
Alternatively, you can run the following command to create the file with the correct content in one go:
Answer the prompts to generate a standardized commit message.
39
50
@@ -57,32 +68,32 @@ If you find the `cz` command annoying or having to `git add`, or push prior to r
57
68
58
69
1. Open `.zshrc` <small>Or `.bashrc` if you're using bash</small>:
59
70
60
-
@@@
71
+
```bash
61
72
vim ~/.zshrc
62
-
@@@
73
+
```
63
74
64
75
2. Add alias:
65
76
66
-
@@@
77
+
```bash
67
78
alias commit='cz'
68
-
@@@
79
+
```
69
80
70
81
Now, you can use the alias `commit` to quickly run the CLI tool. This allows you to type `commit` which could be more intuitive than `cz`.
71
82
72
83
Another one which I personally use, but must be used with caution due to the adding everything and pushing instantly is:
73
84
74
-
@@@
85
+
```bash
75
86
alias push='git add . && cz && git push'
76
-
@@@
87
+
```
77
88
78
89
A safe way to use this, but which is a little bit more time-consuming is to use the following alias:
79
90
80
-
@@@
91
+
```bash
81
92
alias push='git add . && cz && echo "You are about to push $(git diff --cached --numstat | wc -l) files." && echo "Are you sure you want to push these changes? (y/n/c) [Yes/No - commit only/No - abort all]" && read ans && if [[$ans = "y"]]; then git push; elif [[$ans = "n"]]; then echo "Changes committed, but not pushed."; else echo "Operation aborted."; git reset HEAD~; fi'
82
-
@@@
93
+
```
83
94
84
95
This will ask you after the commit if you want to continue with X files or not, giving you the option to push, quit, or only commit.
0 commit comments