I have a pre-commit script that I want to analyze the state of the index only, excluding unstaged changes. At the beginning of the script, I use git stash --keep-index
git stash --keep-index