Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (29.3k points)

First,  I've got "my branch is ahead of origin/master by 3 commits" then my app has reverted to an earlier time with earlier changes.

any ideas about how can I recover a lost commit in git.

1 Answer

0 votes
by (50.2k points)

There are two ways to solve this, the first option is you could use

git reflog 

To find the commits and through that, you can reset using 

git reset --hard <commit-id>

The other option you could use is:

Try:

git log HEAD@{1}

By seeing the output if you feel like those are in right series of commits then you could use:

git reset HEAD@{1}

This will help you to recover the last commit in git.

Browse Categories

...