git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Canonical method of merging two projects
@ 2008-04-14  6:37 Peter Karlsson
  2008-04-14  6:56 ` Gabriel
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Karlsson @ 2008-04-14  6:37 UTC (permalink / raw)
  To: Git Mailing List

Hi!

What is the canonical way of merging an unrelated project into another
so that all of the merged project's files appear in a sub-directory of
the first?

I have two projects, A with files "a.txt" and "b.txt", and B with files
"a.txt" and "c.txt", each in a separate Git repoistory. I want to merge
those two projects, throwing away the B repository, and achieve a
file layout that has "a.txt" and "b.txt" from A, and "B/a.txt" and
"B/c.txt" from B. I.e, the two files with the same name are unrelated,
and all of B's file should end up in a sub-directory.

I do not want to use submodules, since I am planning on throwing B
away.


When I did this, I did a regular "git merge --no-commit", and then
moved the files manually. Thankfully, I only had one duplicated file
name, so fixing the conflict was easy enough. I looked through the
git-merge manual page, but could not find any information about this
use-case.

-- 
\\// Peter - http://www.softwolves.pp.se/

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

* Re: Canonical method of merging two projects
  2008-04-14  6:37 Canonical method of merging two projects Peter Karlsson
@ 2008-04-14  6:56 ` Gabriel
  2008-04-14 18:10   ` Eric Raible
  0 siblings, 1 reply; 3+ messages in thread
From: Gabriel @ 2008-04-14  6:56 UTC (permalink / raw)
  To: git


Hello,

On Mon, 14 Apr 2008 07:37:17 +0100, Peter Karlsson wrote:

> What is the canonical way of merging an unrelated project into another
> so that all of the merged project's files appear in a sub-directory of
> the first?
> 
> I have two projects, A with files "a.txt" and "b.txt", and B with files
> "a.txt" and "c.txt", each in a separate Git repoistory. I want to merge
> those two projects, throwing away the B repository, and achieve a file
> layout that has "a.txt" and "b.txt" from A, and "B/a.txt" and "B/c.txt"
> from B. I.e, the two files with the same name are unrelated, and all of
> B's file should end up in a sub-directory.

This is exactly what the subtree “merge strategy” does;
there is a HOWTO here:
http://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html

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

* Re: Canonical method of merging two projects
  2008-04-14  6:56 ` Gabriel
@ 2008-04-14 18:10   ` Eric Raible
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Raible @ 2008-04-14 18:10 UTC (permalink / raw)
  To: git

Gabriel <g2p.code <at> gmail.com> writes:

> 
> 
> Hello,
> 
> On Mon, 14 Apr 2008 07:37:17 +0100, Peter Karlsson wrote:
> 
> > What is the canonical way of merging an unrelated project into another
> > so that all of the merged project's files appear in a sub-directory of
> > the first?
> > 
> > I have two projects, A with files "a.txt" and "b.txt", and B with files
> > "a.txt" and "c.txt", each in a separate Git repoistory. I want to merge
> > those two projects, throwing away the B repository, and achieve a file
> > layout that has "a.txt" and "b.txt" from A, and "B/a.txt" and "B/c.txt"
> > from B. I.e, the two files with the same name are unrelated, and all of
> > B's file should end up in a sub-directory.
> 
> This is exactly what the subtree “merge strategy” does;
> there is a HOWTO here:
> http://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html
> 

Because the OP is asking about a one-time operation I thought that it might
be easier to instead move all of B's files into a new directory (B/Bproj),
and then commit that in B.

A can then simply pull B, and all of B's files will end up in A/Bproj.

- Eric

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

end of thread, other threads:[~2008-04-14 18:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-14  6:37 Canonical method of merging two projects Peter Karlsson
2008-04-14  6:56 ` Gabriel
2008-04-14 18:10   ` Eric Raible

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