git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j6t@kdbg.org>
To: Thomas Adam <thomas.adam22@gmail.com>
Cc: git list <git@vger.kernel.org>
Subject: Re: Merging changes from branches where file paths have changed
Date: Sat, 14 Apr 2012 21:49:46 +0200	[thread overview]
Message-ID: <4F89D4DA.8010407@kdbg.org> (raw)
In-Reply-To: <CA+39Oz5Jc8Tj6WX+836h_fA6qHDYp6guaoniF6LX027MFHhP0A@mail.gmail.com>

Am 14.04.2012 21:36, schrieb Thomas Adam:
> Hello,
> 
> On 14 April 2012 20:21, Johannes Sixt <j6t@kdbg.org> wrote:
>> You have these histories
>>
>>
>>  A--o--B--C--o--o--D--o--E   <- RepoA
>>
>>  A'----B'-C'                 <- RepoB
>>
>> and you want to cherry-pick D and E to RepoB. Right?
> 
> Yes, that's about right.
> 
>> I suggest that you install a graft in RepoB, then cherry-pick D and E:
>>
>>  echo $(git rev-parse C' C) >> .git/info/grafts
> 
> Can you elaborate on this a little more please?  Or point me towards
> some documentation.  Note that due to the way git-filter-branch works,
> although the history between RepoA and RepoB are common, the commit
> IDs between the two are completely different; presumably
> git-filter-branch uses patch-id at some level to reform commits.
> Nevertheless, if I'm understanding superficially what this graft is
> supposed to do, I do not see how getting a list of commits from C' to
> C is going to help in repoB when neither RepoA or RepoB have any
> ancestry in common?

There is no "list of commits from C' to C". Look carefully: it's
rev-parse, not rev-list. The command above only states that the (only)
parent of C' is C, i.e., it fakes this history:

  A--o--B--C--o--o--D--o--E   <- RepoA
            \
             C'               <- RepoB

and then the two repositories have history in common.

And BTW:

1. C' must be the top-most commit that was derived from RepoA.

2. If D or E add new paths, they will not be moved to the root by the
cherry-pick. Be sure to check the result.

3. If you have additional commits in RepoB that were not derived from
RepoA, it may not work out as smoothly, if the changes are so large that
rename detection does not kick in anymore.

-- Hannes

      reply	other threads:[~2012-04-14 19:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-14 13:15 Merging changes from branches where file paths have changed Thomas Adam
2012-04-14 19:21 ` Johannes Sixt
2012-04-14 19:36   ` Thomas Adam
2012-04-14 19:49     ` Johannes Sixt [this message]

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=4F89D4DA.8010407@kdbg.org \
    --to=j6t@kdbg.org \
    --cc=git@vger.kernel.org \
    --cc=thomas.adam22@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.
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).