the top few commits disappeared after 'git rebase origin'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(I have already worked around the issue, but just would like to report
it and perhaps discuss - please cc'd as I am not subscribed).

I noticed one or two most recent commits I made a few days ago is not around,
so I thought I have mis-remembered it or forgot to do 'git add' (it was adding some reference
notes file from somebody else). But then I saw in my bash command history that
I did all the right things so the new files must be committed somewhere.

Then I google'd, and read about 'git reflog', and indeed I did commit those
new files 3 days ago, but they were not applied after a particular rebase origin. I do a fetch/rebase
every few days, normally straight-forward without collision since I am working in some niche area
of a busy project.

Anyway, I was able to do 'git checkout -b recovery_branch <sha1_head_before_rebase>'
to recover the whole thing. This gets me a bit worried - as it is a busy project,
and I have some 20-30 local commits which are probably staying local
for my convenience for months and years, and I do git rebase all the time.

The only thing different I do this time, as far as I see, was to do 'git branch -m master master_date'
(so that I can do a cleaner master with tidied up and collapsed/refactored commits of local changes)
just before. The repo is on ext4, with a healthy amount of empty space.

The commits which disappeared were the most recent 3. and git fsck --unreachable/--dangling
/--strict don't show those disappearing ones.

I seem to remember I had a similar incident (may or may not be with a 'git branch -m currentbranch' - I don't remember)
but the new HEAD was so wrong - and essentially just a few local commits were applied -
I did a 'git checkout -b recovery_branch <sha1_from_scrollingback_to_the_last_git-log-display>'
and just forgotten about it soon.

Any idea how this might happen, and perhaps make sure it does not happen again, ever?

By the way, this is all essentially on fedora x86_64 linux.
$ git --version
git version 1.8.5.3

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]