From 8950d5cad7a128f7376c2f55d2399352b81e2f46 Mon Sep 17 00:00:00 2001 From: Elad Chen Date: Wed, 14 Aug 2019 16:48:54 +0300 Subject: [PATCH] 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 --- 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", } } ```