Is it possible to undo the changes caused by the following command? If so, how?
git reset --hard HEAD~1
gitgit-resetversion control
Is it possible to undo the changes caused by the following command? If so, how?
git reset --hard HEAD~1
Best Answer
Pat Notz is correct. You can get the commit back so long as it's been within a few days. git only garbage collects after about a month or so unless you explicitly tell it to remove newer blobs.
You can see in the example that the file2 was removed as a result of the hard reset, but was put back in place when I reset via the reflog.