Home WTF Where are my Commits? Finding lost work with `git fsck`
Post
Cancel

WTF Where are my Commits? Finding lost work with `git fsck`

 Preview Image

I always use source control (it’s always git). But every once in a while I lose some work during rebase. Today I lost about two days of work I needed for a presentation … tomorrow.

Luckily I came across this really helpful stack overflow answer.

Using this command locally I got the following output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
> git fsck --no-reflog
Checking object directories: 100% (256/256), done.
Checking objects: 100% (18/18), done.
dangling blob 3b868e702ba6f27f6d66aca28322fe84e20f39ad
dangling tree 3b5c4682db0d81ebc6badb3af912c2b2e01addbd
dangling commit 4a727f885c2e8898aebc1bea833e343c489bf8ce
dangling commit 4f024105cf421799763349cfdf4f329be9d4dc1d
dangling tree 61c29e9ad3da119aebf28c0e75baa537e8546b57
dangling tree 7bd0a28483060e146b4f73a22493cd3e8a40d337
dangling blob bdbc2e03d497d4a41762fd49d79c606eec76a047
dangling tree 227f897815d4423afc32488c6b84c7db69f0fcee
dangling commit 6f13d9e15e915e33a27ed4c2d774905ec0961ef4
dangling blob a2abe5d400493f65afc7632dd74949b32aaa955e
dangling tree a4f5888c9774f2106424d80ae6d0bbe89e2ff2da
dangling tree b0ed3f02aacb58a8afe6920382410a1f53e2ca75
dangling blob dac39331fe62dd5cf0af0fa01480de7e6c8a7842
dangling blob e213e402fb0e39b9ac97a22bb24da89d221adf9b
dangling commit e425207b06f0bc77bd3eabd0446d89aba9679a2e
dangling tree fced6d1ce41f787a009ca825c3f76a94f94950c6

Then it was just a matter of checking out all the dangling commit entries and seeing where the issues where. I was then able to rebase the hash back on to master, and I was back in business.

Always use source control.

-->