I add some new files to index
git add .
then reset
git reset --hard
git deleted these files in my working tree, there are not in repository previously, they are all lost. I lost all my data.
I add some new files to index
git add .
then reset
git reset --hard
git deleted these files in my working tree, there are not in repository previously, they are all lost. I lost all my data.
from the git documentation:
--hard Resets the index and working tree. Any changes to tracked files in the working tree since are discarded.
so this works exactly as documented. You probably wanted to do
git reset
without the --hard
option.
See Recover from git reset --hard? if you want to try to recover your code.