git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
To: Marius Storm-Olsen <mstormo@gmail.com>
Cc: git@vger.kernel.org,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Jonathan Nieder <jrnieder@gmail.com>
Subject: Re: git rebase -p doesn't understand -X
Date: Tue, 19 Apr 2011 11:06:38 +0200	[thread overview]
Message-ID: <BANLkTi=sW_J4LGS=XRuLrwYZTgx4GP65PA@mail.gmail.com> (raw)
In-Reply-To: <4DA87E94.2050700@gmail.com>

On Fri, Apr 15, 2011 at 7:21 PM, Marius Storm-Olsen <mstormo@gmail.com> wrote:
> Hi,
>
> I'm trying to rebase a rather large series of patches, which also contains a
> couple of merges which I'd like to recreate in the rebase, and for the other
> conflicts I'd like git to automatically choose 'ours'.
>
> So, I run
>    git rebase -p -X ours -X patience -X ignore-all-space --onto foo bar baz
> and I get
>    error: unknown switch `X'

Interactive rebase uses cherry-pick internally. Jonathan added support
for -X to that command not too long ago (in commit 67ac1e1, late last
year), so it should be pretty straight-forward to add support for what
you want. Maybe I'll do that in a few weeks when I get back from
vacation.

A related topic is _when_ to use the strategy (and strategy options).
I asked the question on
http://thread.gmane.org/gmane.comp.version-control.git/164241/focus=164543,
but I will try to clarify here.

I saw that when rebase -p was initially introduced by Johannes in
f09c9b8 in 2007, he gave this example:


    Example:

               X
                \
             A---M---B
            /
    ---o---O---P---Q

    When the current HEAD is "B", "git rebase -i -p --onto Q O" will yield

                   X
                     \
    ---o---O---P---Q---A'---M'---B'


Is that similar to what you want? I have normally been thinking about
an example that looks more like:

               C---D
              /     \
             A---B---M
            /
    ---o---O---P---Q

which would yield

                         C'---D'
                        /       \
    ---o---O---P---Q---A'---B'---M'


In such a case, it probably makes sense to use the same strategy to
create A' through D', because the upstream change for all of them
would be the changes from O to Q (the merge base is O). However, when
applying M to form M', that part of the history is not involved (the
merge base is A').

Would it be completely insane to stop passing the strategy when
recreating merges? It seems to me that it would at least be better in
the second example above. Johannes, do you think that would break
things in the first example?

A more advanced solution would be recreate the merge using rerere. We
could first redo the merge from D to B and reset the tree to look like
in M, then record the resolutions and reuse them when doing the merge
to form M'. Makes sense? Overkill? If we want to avoid interfering
with the normal rerere cache, I guess we could use a separate rerere
cache (which I don't think is currently supported).

> Is there any work around to allow me to achieve the same result?

Not that I know of. (Except, of course, piece-wise rebasing the linear
parts of history and doing the merges manually.)


/Martin

  reply	other threads:[~2011-04-19  9:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-15 17:21 git rebase -p doesn't understand -X Marius Storm-Olsen
2011-04-19  9:06 ` Martin von Zweigbergk [this message]
2011-04-20 23:40   ` Jonathan Nieder

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to='BANLkTi=sW_J4LGS=XRuLrwYZTgx4GP65PA@mail.gmail.com' \
    --to=martin.von.zweigbergk@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=mstormo@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).