git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Thomas Rast <trast@student.ethz.ch>
Cc: "Dale R. Worley" <worley@alum.mit.edu>,
	Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org
Subject: Re: What I want rebase to do
Date: Thu, 07 Mar 2013 11:08:50 +0100	[thread overview]
Message-ID: <51386732.1020708@viscovery.net> (raw)
In-Reply-To: <87r4jra942.fsf@pctrast.inf.ethz.ch>

Am 3/7/2013 9:48, schrieb Thomas Rast:
> worley@alum.mit.edu (Dale R. Worley) writes:
> [...snip...]
> 
> Isn't that just a very long-winded way of restating what Junio said
> earlier:
> 
>>> It was suggested to make it apply the first-parent diff and record
>>> the result, I think.  If that were an acceptable approach (I didn't
>>> think about it through myself, though), that would automatically
>>> cover the evil-merge case as well.
> 
> You can fake that with something like
> 
> git rev-list --first-parent --reverse RANGE_TO_REBASE |
> while read rev; do
>     if git rev-parse $rev^2 >/dev/null 2>&1; then
>         git cherry-pick -n -m1 $rev
>         git rev-parse $rev^2 >.git/MERGE_HEAD
>         git commit -C$rev
>     else
>         git cherry-pick $rev
>     fi
> done
> 
> Only tested very lightly.  Dealing with octopii, conflicts and actually
> preserving the commit's attributes is left as an exercise to the
> reader[1].

I proposed this long ago, but by modifying preserve-merges rather than
with a new option (--first-parent):
http://thread.gmane.org/gmane.comp.version-control.git/198125

It works very well. I'm using it frequently in the field.

-- Hannes

  reply	other threads:[~2013-03-07 10:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-04 20:58 "git rebase" loses the additional changes in "evil" merges Dale R. Worley
2013-03-04 21:18 ` Junio C Hamano
2013-03-04 21:24   ` Thomas Rast
2013-03-04 21:41     ` Junio C Hamano
2013-03-06 18:55       ` What I want rebase to do Dale R. Worley
2013-03-07  8:48         ` Thomas Rast
2013-03-07 10:08           ` Johannes Sixt [this message]
2013-03-07 17:38           ` Junio C Hamano
2013-03-07 22:06           ` Dale R. Worley
2013-03-05 21:18   ` "git rebase" loses the additional changes in "evil" merges Dale Worley
2013-03-05 21:35     ` Junio C Hamano
2013-03-05 23:16       ` Philip Oakley
2013-03-05 23:31         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51386732.1020708@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=trast@student.ethz.ch \
    --cc=worley@alum.mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).