android – Made Reset Head hard but forgot to commit

Question:

After the changes, I decided to roll back and made a Reset Head hard. And rolled far back. Only apk left. Is it possible to restore a project by apk?

Answer:

It is desirable: before you start working with the repository, make a backup copy of the entire directory so that you can practice on the copy beforehand or restore the old state.

If your changes have been committed (even if only locally, without committing to a remote repository is enough), then it is quite possible to return to them, even after you roll back far back. (Provided that the operations of cleaning the repository from unnecessary / obsolete links were not launched – they are usually stored for 30 days).

All you need to do is remember two simple commands:

git reflog

and

git reset --hard HEAD@{123}

Perhaps this article will come in handy, I once studied the possibility of returning from it: git reset: turn back time

Scroll to Top