Undo delete in GIT

Do yourself a favour and do not do git checkout <hash> like the other answer suggests and go into more problems.

IF you have deleted file from your working directory and not committed the changes yet, do:

git checkout -f

CAUTION: commit uncommitted files before executing this command, otherwise you’re going to lose them all

The deleted files should be back again.

If not and if you can find the commit that you want ( C, etc. – your question is not clear ) from git reflog, just do git reset --hard <hash from reflog> and you should be all set.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)