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:21:26 +0200	[thread overview]
Message-ID: <4F89CE36.4000607@kdbg.org> (raw)
In-Reply-To: <CA+39Oz7m1hGrTEdpSAjBP3EDFSVyKdc6T9CORcwQkjuEbvD4Ug@mail.gmail.com>

Am 14.04.2012 15:15, schrieb Thomas Adam:
> The commits though coming from "git log" in RepoA touch files in
> distrib/build/sources/coretree/tree, yet the files to which I want the
> changes for in RepoB are not in "distrib/build/sources/coretree/tree"
> -- there all in "./" at the top-level directory for RepoB.  The files
> in both once shared the same history -- it's just that now the
> locations of those files in RepoB which have changed.
> 
> I want to cherry-pick the commits I obtained from the "git log"
> command in RepoA, and have them contained in RepoB.  So I thought
> something like this would work:
> 
> [ In RepoB.... ]:
> % git remote add repoA file:///path/to/repoA/
> % git fetch repoA
> % git checkout specific/branch
> % git cherry-pick $SOME_COMMIT_FROM_REPOA

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?

I suggest that you install a graft in RepoB, then cherry-pick D and E:

  echo $(git rev-parse C' C) >> .git/info/grafts
  git cherry-pick D
  git cherry-pick E

Then it will look as if everything outside the directory was removed,
and everything else was moved from the directory to the root with 100%
similarity, which makes the merge process easy. (This works only if
there are no files with the same names in C's and C''s root; a Makefile
in each would pose a problem.)

(Remove the graft when you're done.)

-- Hannes

  reply	other threads:[~2012-04-14 19:21 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 [this message]
2012-04-14 19:36   ` Thomas Adam
2012-04-14 19:49     ` Johannes Sixt

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=4F89CE36.4000607@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).