Changes between Version 23 and Version 24 of GitForDarcsUsers


Ignore:
Timestamp:
Aug 15, 2008 2:23:17 PM (7 years ago)
Author:
nominolo
Comment:

Some tips for recovering from a bad rebase

Legend:

Unmodified
Added
Removed
Modified
  • GitForDarcsUsers

    v23 v24  
    109109
    110110See {{{git rebase --help}}} for more usage information and more examples.
     111
     112=== Uh-oh, I trashed my repo with a rebase, what do I do? ===
     113
     114Two Options:
     115
     116 1. Recover from the backup copy (you ''did'' make backup copy before the rebase, didn't you?)
     117
     118 2. In case you were in a hurry and option 1 is not an option for you, there may be some hope.  Git actually has a bit of a functional philosophy in that it doesn't immediately throw away the orignal commits.  Git uses garbage collection for this, which is called automatically every once in a while.
     119
     120Suppose we started with this repository state
     121{{{
     122      A---B---C---D <-- feature1
     123;
     124o---o---o---o---o <-- master
     125}}}
     126and decided to remove {{{B}}} from our history.  The actual repository now looks like this:
     127{{{
     128        C'--D' <-- feature1
     129;
     130      A---B---C---D
     131;
     132o---o---o---o---o <-- master
     133}}}
     134If you happen to have the commit id of {{{D}}} (maybe in your console backlog) you can create a branch {{{feature1_old}}} that points to {{{D}}} via
     135{{{
     136$ git checkout -b feature1_old <commit-id-of-D>
     137}}}
     138Now you have a handle to both {{{D'}}} and {{{D}}}.
    111139
    112140= General Settings =