You can simply remove and reinstall the corrupt files from the index as follows:
rm <files> git checkout -- <files>
Or, if they are just modified files (be careful with this command), you can script to do it like this:
git diff --name-only --diff-filter=M | xargs rm -- git checkout -- .
On the GNU system, you can use a slightly more secure pipe, but in any case, you should not have spaces or other separators in your names.
git diff -z --name-only --diff-filter=M | xargs -0 rm --
Charles Bailey Oct 21 '09 at 6:23 2009-10-21 06:23
source share