git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Replay on arbitrary branches
@ 2005-09-03  1:11 Martin Langhoff
  2005-09-03  1:47 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Langhoff @ 2005-09-03  1:11 UTC (permalink / raw
  To: Git Mailing List

Is there a way to replay a merge on a head that GIT considers unrelated? 

I have been playing with exporting to mbox format with
git-format-patch-script, and applying those to the destination branch.
However, this drops binary files -- and I _do_ have binary files in
some of the projects I work on.

cheers,


martin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Replay on arbitrary branches
  2005-09-03  1:11 Replay on arbitrary branches Martin Langhoff
@ 2005-09-03  1:47 ` Junio C Hamano
  2005-09-03  2:17   ` Martin Langhoff
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2005-09-03  1:47 UTC (permalink / raw
  To: martin.langhoff; +Cc: git

Martin Langhoff <martin.langhoff@gmail.com> writes:

> Is there a way to replay a merge on a head that GIT considers unrelated? 
>
> I have been playing with exporting to mbox format with
> git-format-patch-script, and applying those to the destination branch.
> However, this drops binary files -- and I _do_ have binary files in
> some of the projects I work on.

I do not think your question has much to do with 'GIT considers
unrelated'.  The 'git resolve' machinery would have the same
problem with related trees, if you do keep track of binary
files, and you are changing them in both branches.  The 3-way
merge resolution step will eventually invoke 'merge' or 'diff3'
and you lose.

About 'unrelated' trees, if you know of a good tree you can use
as a reference point, you could manually emulate what 'git
resolve' does.  Let's say you have project A and project B; for
whatever historical reasons you do not have a common ancestor of
these project master branch heads.

    $ git clone projectA/.git merged
    $ cd merged
    $ git fetch ../projectB/.git master:b

Now refs/heads/master is projectA's head, and refs/heads/b is
projectB's.  They may not be related, but if you know a commit c
that was in some shared past from both projects, you probably
can:

    $ git-read-tree -m -u c master b
    $ git-merge-cache -o git-merge-one-file-script -a

If the resulting tree looks reasonable, you could now commit it
telling 'git-commit-tree' that the parents of the new commit are
master and b, and you practically merged two projects.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Replay on arbitrary branches
  2005-09-03  1:47 ` Junio C Hamano
@ 2005-09-03  2:17   ` Martin Langhoff
  0 siblings, 0 replies; 3+ messages in thread
From: Martin Langhoff @ 2005-09-03  2:17 UTC (permalink / raw
  To: Junio C Hamano; +Cc: git

Agreed on the impossibility of 3-way merges with binary files. In the
branch I want to replay, though, I have commits that add and change
binary files.

> About 'unrelated' trees, if you know of a good tree you can use

<setup snipped>

>     $ git-read-tree -m -u c master b
>     $ git-merge-cache -o git-merge-one-file-script -a
> 
> If the resulting tree looks reasonable, you could now commit it
> telling 'git-commit-tree' that the parents of the new commit are
> master and b, and you practically merged two projects.

Cool! I think this is what I was looking for. The call to
git-read-tree will act as if A and B had branched off at tree "C".
I'll have to read the doco on git-read-tree and git-merge-cache a bit
more to feel comfortable with this voodoo, but it's great.

cheers,


martin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-09-03  2:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-03  1:11 Replay on arbitrary branches Martin Langhoff
2005-09-03  1:47 ` Junio C Hamano
2005-09-03  2:17   ` Martin Langhoff

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).