I've been working on a project for a while and used git from the beginning. After a few commits, I made a change to a file which I realised was unnecessary. In an attempt to discard those changes and return to the state of the latest commit, I used:
git stash save --keep-index
which gave me the output:
Saved working directory and index state WIP on master: cc91857 fixed animation bug HEAD is now at cc91857 fixed animation bug
and dropped the stash by typing
git stash drop
Output:
Dropped refs/stash@{0} (dfb694b90757d8d25318b09da4f5dad2f3be20a6)
However, instead of changing the edited file to the state of the last commit, it was changed to the state of the initial commit, although my head remained at the same commit. To my horror, I have discovered that the file that contained changes I originally wanted to drop now appears to have remained unchanged between the first commit and the most recent one. Other files are not affected.
Is there any way to reset the file to the state of my last recent commit?