I mistakenly added a directory to git and when I followed the tip here to undo the add by doing git reset HEAD <file>
, I was horrified to discover that the current working copy of one of the files, which has lots of changes (work!) in it, reverted back to the previous version!
As a result I lost several hours worth of work... :((
I thought that git reset HEAD <file>
only "removes it from the current index without changing anything else. What did I miss?
Is git reset HEAD <file>
supposed to also check out the file from HEAD?
How can I minimize the chances of something like this happening again in the future?