{"thread":{"id":"13107","subject":"Canonical method of merging two projects","startedAt":"2008-04-14T06:37:17Z","lastAt":"2008-04-14T18:10:28Z","messageCount":3,"participants":["Peter Karlsson","Gabriel","Eric Raible"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"74311","messageId":"Pine.LNX.4.64.0804140733500.7014@ds9.cixit.se","threadId":"13107","inReplyTo":null,"subject":"Canonical method of merging two projects","fromName":"Peter Karlsson","fromEmail":"peter@softwolves.pp.se","sentAt":"2008-04-14T06:37:17Z","receivedAt":"2008-04-14T06:37:17Z","isPatch":false,"sender":{"key":"peter@softwolves.pp.se","avatar":"https://avatars.githubusercontent.com/u/990764?v=4"},"body":"Hi!\n\nWhat is the canonical way of merging an unrelated project into another\nso that all of the merged project's files appear in a sub-directory of\nthe first?\n\nI have two projects, A with files \"a.txt\" and \"b.txt\", and B with files\n\"a.txt\" and \"c.txt\", each in a separate Git repoistory. I want to merge\nthose two projects, throwing away the B repository, and achieve a\nfile layout that has \"a.txt\" and \"b.txt\" from A, and \"B/a.txt\" and\n\"B/c.txt\" from B. I.e, the two files with the same name are unrelated,\nand all of B's file should end up in a sub-directory.\n\nI do not want to use submodules, since I am planning on throwing B\naway.\n\n\nWhen I did this, I did a regular \"git merge --no-commit\", and then\nmoved the files manually. Thankfully, I only had one duplicated file\nname, so fixing the conflict was easy enough. I looked through the\ngit-merge manual page, but could not find any information about this\nuse-case.\n\n-- \n\\\\// Peter - http://www.softwolves.pp.se/\n"},{"id":"74317","messageId":"ftuv6o$vch$1@ger.gmane.org","threadId":"13107","inReplyTo":"Pine.LNX.4.64.0804140733500.7014@ds9.cixit.se","subject":"Re: Canonical method of merging two projects","fromName":"Gabriel","fromEmail":"g2p.code@gmail.com","sentAt":"2008-04-14T06:56:25Z","receivedAt":"2008-04-14T06:56:25Z","isPatch":false,"sender":{"key":"g2p.code@gmail.com","avatar":null},"body":"\nHello,\n\nOn Mon, 14 Apr 2008 07:37:17 +0100, Peter Karlsson wrote:\n\n> What is the canonical way of merging an unrelated project into another\n> so that all of the merged project's files appear in a sub-directory of\n> the first?\n> \n> I have two projects, A with files \"a.txt\" and \"b.txt\", and B with files\n> \"a.txt\" and \"c.txt\", each in a separate Git repoistory. I want to merge\n> those two projects, throwing away the B repository, and achieve a file\n> layout that has \"a.txt\" and \"b.txt\" from A, and \"B/a.txt\" and \"B/c.txt\"\n> from B. I.e, the two files with the same name are unrelated, and all of\n> B's file should end up in a sub-directory.\n\nThis is exactly what the subtree “merge strategy” does;\nthere is a HOWTO here:\nhttp://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html\n"},{"id":"74368","messageId":"loom.20080414T180449-850@post.gmane.org","threadId":"13107","inReplyTo":"ftuv6o$vch$1@ger.gmane.org","subject":"Re: Canonical method of merging two projects","fromName":"Eric Raible","fromEmail":"raible@gmail.com","sentAt":"2008-04-14T18:10:28Z","receivedAt":"2008-04-14T18:10:28Z","isPatch":false,"sender":{"key":"raible@gmail.com","avatar":null},"body":"Gabriel <g2p.code <at> gmail.com> writes:\n\n> \n> \n> Hello,\n> \n> On Mon, 14 Apr 2008 07:37:17 +0100, Peter Karlsson wrote:\n> \n> > What is the canonical way of merging an unrelated project into another\n> > so that all of the merged project's files appear in a sub-directory of\n> > the first?\n> > \n> > I have two projects, A with files \"a.txt\" and \"b.txt\", and B with files\n> > \"a.txt\" and \"c.txt\", each in a separate Git repoistory. I want to merge\n> > those two projects, throwing away the B repository, and achieve a file\n> > layout that has \"a.txt\" and \"b.txt\" from A, and \"B/a.txt\" and \"B/c.txt\"\n> > from B. I.e, the two files with the same name are unrelated, and all of\n> > B's file should end up in a sub-directory.\n> \n> This is exactly what the subtree “merge strategy” does;\n> there is a HOWTO here:\n> http://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html\n> \n\nBecause the OP is asking about a one-time operation I thought that it might\nbe easier to instead move all of B's files into a new directory (B/Bproj),\nand then commit that in B.\n\nA can then simply pull B, and all of B's files will end up in A/Bproj.\n\n- Eric\n"}]}