I am trying to set up a pre-commit hook to test my project before any commit goes through, but I can't find how to make sure that only HEAD (with patches from the current commit) are tested and not the current working_tree (which in most cases is dirty for me).
Solutions found:
Found this link and ended up doing the following.
http://newartisans.com/2009/02/building-a-better-pre-commit-hook-for-git/
# Checkout a copy of the current index into MIRROR
git checkout-index --prefix=$TMPDIR/ -af
# Remove files from MIRROR which are no longer present in the index
git diff-index --cached --name-only --diff-filter=D -z HEAD | \
(cd $TMPDIR && xargs -0 rm -f --)