Git · Middle · Question 8 of 75

You ran git reset --hard and lost a commit. How can you get it back?

Explanation

The reflog records every position HEAD and branches had locally, usually for 90 days. git branch rescue <hash> brings the commit back.

Further reading

Problem with a question

Git · Middle · question 8

Test yourself

Take the Git · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz