git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Manuel Reimer <mail+git@m-reimer.de>
To: git@vger.kernel.org
Subject: Re: How to integrate external repo into existing directory of a bigger repo (git subtree)?
Date: Fri, 25 Dec 2020 11:12:23 +0100	[thread overview]
Message-ID: <31b0d4a2-249f-ec18-8b7c-24b4a6165e7b@m-reimer.de> (raw)
In-Reply-To: <e30c1de9-9449-78d6-99eb-c3bbad673903@m-reimer.de>

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

      reply	other threads:[~2020-12-25 10:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-24 14:53 How to integrate external repo into existing directory of a bigger repo (git subtree)? Manuel Reimer
2020-12-25 10:12 ` Manuel Reimer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=31b0d4a2-249f-ec18-8b7c-24b4a6165e7b@m-reimer.de \
    --to=mail+git@m-reimer.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).