From e382a52cf10cf080a6317ea04ed03d518cabbe7a Mon Sep 17 00:00:00 2001 From: Sonny Date: Sat, 13 Jul 2019 21:43:21 +0200 Subject: [PATCH] Stash unstaged changes to support patching --- pre-commit | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pre-commit b/pre-commit index d1e29b9..cee781b 100755 --- a/pre-commit +++ b/pre-commit @@ -1,4 +1,5 @@ #!/bin/bash +STASH_NAME="pre-commit-$(date %d-%m-%Y-%H-%M-%S)" # Check if the directory is the root directory if [ ! -d ".git/" ]; then @@ -6,8 +7,12 @@ if [ ! -d ".git/" ]; then exit 1 fi +git stash push --quiet --keep-index --message $STASH_NAME + # Run every file inside the pre-commit.d directory for file in .git/hooks/pre-commit.d/* do . $file done + +git stash pop --quiet