[Development] Recover from a bad rebase (incorrect squash)

Konstantin Tokarev annulen at yandex.ru
Mon Oct 21 14:12:31 CEST 2013



21.10.2013, 16:06, "Mandeep Sandhu" <mandeepsandhu.chd at gmail.com>:
>>>  Hi All,
>>>
>>>  Is there a safe to recover from a bad rebase ? I've squashed commits
>>>  incorrectly.
>>  Use 'git reflog' to get the HEAD of the commit before the squash, and use git reset to restore it.
>
> Thanks Kai! That fixed it!

Note that it's very hard to lose committed data in git - reflog will recover you from wrong
git commit --amend, git reset --hard, git branch -D, etc. Old copies of each object you modify
are kept at least for 2 weeks in default configuration.

Uncommitted changes in working copy are much more vulnerable.

-- 
Regards,
Konstantin



More information about the Development mailing list