rynmrtn
rynmrtn

Reputation: 3429

Git - Restore lost commits

As the team I'm on has grown, we have seen a number of situations where commits get lost due to merge mistakes.

We are working on the educational aspect already, but when this happens, what are some of the best ways in git to restore the lost commits - I've heard of using commands like git bisect and manually checking out each commit. What else is out there to help?

Upvotes: 0

Views: 156

Answers (2)

Daniel Hilgarth
Daniel Hilgarth

Reputation: 174457

git reflog can be used to find out the commit hashes of commits that are no longer on any branch but haven't yet been gc'ed.

Upvotes: 2

hd1
hd1

Reputation: 34677

Looks like you need git fsck --lost-found

Upvotes: 2

Related Questions