From: Thomas Adam <thomas.adam22@gmail.com>
To: git list <git@vger.kernel.org>
Subject: Merging changes from branches where file paths have changed
Date: Sat, 14 Apr 2012 14:15:38 +0100 [thread overview]
Message-ID: <CA+39Oz7m1hGrTEdpSAjBP3EDFSVyKdc6T9CORcwQkjuEbvD4Ug@mail.gmail.com> (raw)
Hi all,
I've got two git repositories -- for the purposes of illustration,
I'll call them RepoA, and RepoB. RepoA is a large repository
originally from a CVS conversion. Repo B is a repository which has
been formed from git-filter-branch (should it matter) from RepoA.
In doing the conversion -- RepoB contains the same history as in
RepoA, except that RepoB is now a limited subset in terms of its files
that RepoA has (repoB contains commits out of repoA for a specific
subdirectory). However, the problem I'm wanting to solve now, which
is causing me to scratch my head and go "hmm", is how I go about
merging commits from RepoA and have them in RepoB -- where the commits
from repoA are in the same *directory* as the one which formed RepoB.
In RepoA, for the directory (and all its sub-directories) which is
contained in RepoB, I've got a list of commits -- roughly like the
following:
% cd ./distrib/build/sources/coretree/tree
% git log --oneline master..my/topic/branch -- .
Now in RepoB, I've got all of the directories and files from
./distrib/build/sources/coretree/tree/ in the root, having obtained
this from git-filter-branch from RepoA. Despite the change of file
locations, the history of the files between the two repositories are
the same.
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
However, this won't work, and doesn't. Not only do the two
repositories not have any common ancestry, but even if they did, the
file paths from RepoA and RepoB do not match for the commit(s) I would
want to cherry-pick. As far as I can tell, were I able to convince
Git the file paths did work, then I could cherry-pick them.
Can anyone suggest a good way round this? I hope I've managed to
explain this adequately; just ask if not.
Thanks in Advance.
-- Thomas Adam
next reply other threads:[~2012-04-14 13:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-14 13:15 Thomas Adam [this message]
2012-04-14 19:21 ` Merging changes from branches where file paths have changed Johannes Sixt
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=CA+39Oz7m1hGrTEdpSAjBP3EDFSVyKdc6T9CORcwQkjuEbvD4Ug@mail.gmail.com \
--to=thomas.adam22@gmail.com \
--cc=git@vger.kernel.org \
/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).