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

How to integrate external repo into existing directory of a bigger repo (git subtree)?

From
MRManuel Reimer <mail+git@m-reimer.de>
Date
Dec 24, 2020, 14:53 UTC
Message-ID
<e30c1de9-9449-78d6-99eb-c3bbad673903@m-reimer.de>
Hello,

some while ago (before I found out that "git subtree" exists), I've set up a big GIT repo consisting of several smaller modules. It was way more convenient to maintain them all in one repository compared to having each in its own repository.

As I need a separate repository per module for technical reasons, I wrote a shellscript which temporarily checks out the external repository, deletes all files, places the files from my big repo, creates a generic commit with auto-generated commit message and then pushes this to the server.

So what I have now is:
- Big repo consisting of many small modules, each one in its own
   directory with proper commit messages
- Several external repositories with autogenerated commit messages
What I want to do is porting this over to "git subtree" somehow, but:
- I would prefer to not loose history in the "big repo"
- I can't force-push to the small external repositories (blocked)

Is there any chance to somehow "restart" the history of an existing directory in a way to reproduce the commits of the external repository so "git subtree" works as intended and I can "git subtree push" without running into the server side "force push" block? I know that reorganizing my whole big repo would do the trick as the subtree would be added to a directory that never existed, but I would prefer to keep it organized the way it is.

Thanks in advance
Manuel
Next: Manuel Reimer
Message 1 of 2 in “How to integrate external repo into existing directory of a bigger repo (git subtree)?”
  1. Manuel ReimerDec 24, 2020
  2. Manuel ReimerDec 25, 2020

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.