First I checkout a branch
> git checkout -b renaming-Foo-to-Bar
then I edit the files to rename instances of class Foo to Bar. Subsequently
> git add -u
but now I omit to run git commit -m "renamed Foo to Bar"
.
Thinking that I did commit, I proceed to merge the branch to master.
> git checkout master
> git merge renaming-Foo-to-Bar
It's only after I read the merge message (something of the sort "nothing to merge") that I realize that I didn't commit.
IIUC, I now have a so-called "dangling commit", and by running
> git fsck --lost-found
Checking object directories: 100% (256/256), done.
dangling blob 03c044a..cb
dangling commit ab8076f..47
dangling commit 128532d..99
dangling commit 5605e2d..4a
I can recover it. But the dangling commit
and dangling blob
messages do not come with a timestamp or other identifying information.
How do I recover such a dangling commit?
Unfortunately my dangling commits/blobs
are many:
> git fsck --lost-found | wc
Checking object directories: 100% (256/256), done.
52 142 2806
Running git show 03c044a..cb
on the first few and last few SHAs reveals changes deep in my history, not recent ones.