From d57d49b15b5b3eabdedf7e0f84a4aeb6160f6756 Mon Sep 17 00:00:00 2001 From: Elad Chen Date: Tue, 13 Aug 2019 11:15:47 +0300 Subject: [PATCH] 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 --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index eb42120c..ce068ce1 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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", } } ```