Run git checkout-index in the git dir. This is necessary to make things work when in a subdir, since git diff prints paths relative to the working tree root but git checkout-index expects (and prints) paths relative to (its) current directory.