Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
docs: Add short circuit to hook example
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 Aug 13, 2019
commit d57d49b15b5b3eabdedf7e0f84a4aeb6160f6756
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
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