Skip to content

Commit

Permalink
docs: Add short circuit to hook example (#665)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
eladchen authored and jimthedev committed Aug 14, 2019
1 parent a472e52 commit 8950d5c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions README.md
Expand Up @@ -142,8 +142,7 @@ Update `.git/hooks/prepare-commit-msg` with the following code:

```
#!/bin/bash
exec < /dev/tty
node_modules/.bin/git-cz --hook
exec < /dev/tty && node_modules/.bin/git-cz --hook || true
```

##### Husky
Expand All @@ -152,7 +151,7 @@ For `husky` users, add the following configuration to the project's `package.jso
```
"husky": {
"hooks": {
"prepare-commit-msg": "exec < /dev/tty && git cz --hook",
"prepare-commit-msg": "exec < /dev/tty && git cz --hook || true",
}
}
```
Expand Down

0 comments on commit 8950d5c

Please sign in to comment.