git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Canonical method of merging two projects

From
EREric Raible <raible@gmail.com>
Date
Apr 14, 2008, 18:10 UTC
Message-ID
<loom.20080414T180449-850@post.gmane.org>
In-Reply-To
<ftuv6o$vch$1@ger.gmane.org>
Gabriel <g2p.code <at> gmail.com> writes:
Show 21 quoted lines
> 
> 
> 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
Previous: Gabriel
Message 3 of 3 in “Canonical method of merging two projects”
  1. Peter KarlssonApr 14, 2008
  2. GabrielApr 14, 2008
  3. Eric RaibleApr 14, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.