Skip to content

Commit de50679

Browse files
committed
Updated protection hook.
1 parent 44d63f9 commit de50679

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

install_protection_hook.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,18 @@ do
2525
then
2626
thisfile=${file/.\*/\*}
2727
echo "File $thisfile is protected but has local changes."
28-
echo "Restore the file with 'git restore "${thisfile}"' before commiting anything, or force this commit with 'commit --no-verify'."
28+
echo "Restore the file with 'git restore "${thisfile}"' before commiting anything,"
29+
echo "or force this commit with 'git commit --no-verify'."
2930
exit 1
3031
fi
3132
git diff --cached --name-only | grep '^'${file}'$' &> /dev/null
3233
if [ $? -eq 0 ]
3334
then
3435
thisfile=${file/.\*/\*}
3536
echo "File $thisfile is protected but has local changes that are staged."
36-
echo "Restore the file with 'git restore "${thisfile}"' before commiting anything, or force this commit with 'commit --no-verify'."
37+
echo "First unstage the file with 'git restore --staged "${thisfile}"', then "
38+
echo "restore the file with 'git restore "${thisfile}"' before commiting anything."
39+
echo "Alternatively, force this commit with 'git commit --no-verify'."
3740
exit 1
3841
fi
3942
done

0 commit comments

Comments
 (0)