Thread (2 messages) 2 messages, 1 author, 2020-12-25

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

From: Manuel Reimer <hidden>
Date: 2020-12-25 10:13:54

On 24.12.20 15:53, Manuel Reimer wrote:
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)
Just for the record: I found a way to fix this properly.

The way to go is:

- Create a new, empty, GIT repository (git init)
- For some reason (bug?) "git subtree" fails on a completely new repo, 
so I had to add one initial commit (I used this to add a small helper 
shellscript that I want to use to simplify my "git subtree" work).
- Now add all the wanted "git subtrees" from their existing "external 
repositories" to the, so far, nearly empty repo. This creates a proper 
"Add ..." commit which seems to be the key to not break pushing to the 
external repo.
- After adding all subtrees, pull from the "big repo", resolve conflicts 
and create a merge commit.

At this point I was able to "git subtree push" without needing to force. 
This also transferred proper history for the subtrees to the individual 
external repos. Even the final push to my "big repo" worked without forcing.

Regards,

Manuel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help