From c0904da9913f5dc49eacff2890bb1bfb854b7ec7 Mon Sep 17 00:00:00 2001 From: Balakrishnan Balasubramanian Date: Mon, 19 Feb 2024 15:31:17 -0500 Subject: [PATCH] output error message to stderr --- pre-commit-staged-check.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/pre-commit-staged-check.sh b/pre-commit-staged-check.sh index e06e2ef..a4244ba 100755 --- a/pre-commit-staged-check.sh +++ b/pre-commit-staged-check.sh @@ -11,6 +11,7 @@ case $GIT_INDEX_FILE in *.lock) if GIT_INDEX_FILE=${GIT_INDEX_FILE%.lock} git status --porcelain | grep '^M' then + exec 1>&2 # Redirect output to stderr. echo "Error: Found both staged and unstaged changes when trying to commit with 'git commit -a'." echo "Do two seperate commits with, 'git commit -m ...' and 'git commit -a -m ...'" echo "Or 'git reset .' and then 'git commit -a -m ...' for a single commit"