Merge pull request #1118 from arrbee/fix-reset-hard Fix checkout corner cases, index handling, and reset hard behavior