Re: Is rebase always destructive?

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

 



Csaba Henk wrote:
Hi,

When doing a rebase, I can find a number of reasons for which one might
feel like to preserve the rebased branch (that is, perform an operation
which copies the branch over a new base, not moves).

-  For example, a successful rebase doesn't necessarily mean that the
   code, as of the rebased branch, is consistent and compiles. That is,
   the rebase can be broken even if git can put things together diff-wise.
   In such a case I wouldn't be happy to lose the original instance of
   the branch.

-  Or I might want to build different versions of the program, and each
   version of it needs a given set of fixes (the same one). Then rebasing
   my bugfix branch is not a good idea, I'd much rather copy it over all
   those versions.

I can't see any option for rebase which would yield this cp-like
behaviour. Am I missing something? Or people don't need such a feature?
(Then give me some LART please, my mind is not yet gittified enough to
see why is this not needed.) Or is it usually done by other means, not
rebase?


When I feel I'm in any danger of ending up with mis-compiles or whatnot,
I usually do
 git checkout -b try-rebase
 git rebase $target
which does exactly what you want.

For almost all other operations, it's possible to get your previous
branch-pointer back, either by referencing ORIG_HEAD, or the reflogs.

--
Andreas Ericsson                   andreas.ericsson@xxxxxx
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
--
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]

  Powered by Linux