Git revert files which cleaned

fmchanprogrammingLeave a Comment

git reset --hard CommitId && git clean -f

The above command is a very serious git action which loses commit history. All the files changed or created are reset and disappeared.

Luckily there is a way to rollback the commit which can appear again:

git reflog show
got reset HEAD@{numberOfHistory}

It saves my life and hope it would save yours.

Leave a Reply

Your email address will not be published. Required fields are marked *