Skip to content

Commit 8950d5c

Browse files
eladchenjimthedev
authored andcommitted
docs: Add short circuit to hook example (#665)
The prepare-commit-msg git hook examples (bash & husky) assume /dev/tty is always true This change fails silently in case /dev/tty is false. See #634
1 parent a472e52 commit 8950d5c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ Update `.git/hooks/prepare-commit-msg` with the following code:
142142

143143
```
144144
#!/bin/bash
145-
exec < /dev/tty
146-
node_modules/.bin/git-cz --hook
145+
exec < /dev/tty && node_modules/.bin/git-cz --hook || true
147146
```
148147

149148
##### Husky
@@ -152,7 +151,7 @@ For `husky` users, add the following configuration to the project's `package.jso
152151
```
153152
"husky": {
154153
"hooks": {
155-
"prepare-commit-msg": "exec < /dev/tty && git cz --hook",
154+
"prepare-commit-msg": "exec < /dev/tty && git cz --hook || true",
156155
}
157156
}
158157
```

0 commit comments

Comments
 (0)