# git diff from a pre-commit hook

1 messages from 2020-02-17 to 2020-02-17. Participants: Michael Strelnikov.
Thread: https://gitlist.dev/t/52822

## Michael Strelnikov, 2020-02-17 09:00

Subject: git diff from a pre-commit hook
Message-ID: <CANno94g7S68OfXNJ5B-uKR5=oZn3dsuDsuZHnKrh7tXzYWPNig@mail.gmail.com>
URL: https://gitlist.dev/e/CANno94g7S68OfXNJ5B-uKR5%3DoZn3dsuDsuZHnKrh7tXzYWPNig%40mail.gmail.com

```
Hello,

   I'm trying to implement the pre-commit hook and faced a problem.
   1. If I just run command "git diff --staged --name-only
--diff-filter=A" I get an error: "fatal: unable to read [SHA]"
   2. After searching for solutions I found that for a pre-commit hook
I have to re-set the GIT_INDEX_FILE variable to ".git/index". After
doing that I see that diff is not honoring the "info/exclude"
settings.

Is there anything else I need to set to make diff working properly?

Best regards,
Michael Strelnikov

```
