{"thread":{"id":"35884","subject":"the top few commits disappeared after 'git rebase origin'","startedAt":"2014-02-15T17:40:59Z","lastAt":"2014-02-15T17:40:59Z","messageCount":1,"participants":["Hin-Tak Leung"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"234861","messageId":"1392486059.58043.YahooMailBasic@web172304.mail.ir2.yahoo.com","threadId":"35884","inReplyTo":null,"subject":"the top few commits disappeared after 'git rebase origin'","fromName":"Hin-Tak Leung","fromEmail":"htl10@users.sourceforge.net","sentAt":"2014-02-15T17:40:59Z","receivedAt":"2014-02-15T17:40:59Z","isPatch":false,"sender":{"key":"htl10@users.sourceforge.net","avatar":null},"body":"(I have already worked around the issue, but just would like to report\nit and perhaps discuss - please cc'd as I am not subscribed).\n\nI noticed one or two most recent commits I made a few days ago is not around,\nso I thought I have mis-remembered it or forgot to do 'git add' (it was adding some reference\nnotes file from somebody else). But then I saw in my bash command history that\nI did all the right things so the new files must be committed somewhere.\n\nThen I google'd, and read about 'git reflog', and indeed I did commit those\nnew files 3 days ago, but they were not applied after a particular rebase origin. I do a fetch/rebase\nevery few days, normally straight-forward without collision since I am working in some niche area\nof a busy project.\n\nAnyway, I was able to do 'git checkout -b recovery_branch <sha1_head_before_rebase>'\nto recover the whole thing. This gets me a bit worried - as it is a busy project,\nand I have some 20-30 local commits which are probably staying local\nfor my convenience for months and years, and I do git rebase all the time.\n\nThe only thing different I do this time, as far as I see, was to do 'git branch -m master master_date'\n(so that I can do a cleaner master with tidied up and collapsed/refactored commits of local changes)\njust before. The repo is on ext4, with a healthy amount of empty space.\n\nThe commits which disappeared were the most recent 3. and git fsck --unreachable/--dangling\n/--strict don't show those disappearing ones.\n\nI seem to remember I had a similar incident (may or may not be with a 'git branch -m currentbranch' - I don't remember)\nbut the new HEAD was so wrong - and essentially just a few local commits were applied -\nI did a 'git checkout -b recovery_branch <sha1_from_scrollingback_to_the_last_git-log-display>'\nand just forgotten about it soon.\n\nAny idea how this might happen, and perhaps make sure it does not happen again, ever?\n\nBy the way, this is all essentially on fedora x86_64 linux.\n$ git --version\ngit version 1.8.5.3\n"}]}