I am working on a private repository A
that extends and builds on some earlier work I put into a public repository B
. However, A
already contains a lot of work not coming from B
, so that I would like to copy B
into a subdirectory of A
(let's call this copy B'
).
Requirements:
- The public repository
B
must remain in the state it is because that serves for future reference. It may develop further, but this development will not be synchronized withA
. - The private repository
A
must maintain the history of the public repositoryB
.A
will remain private for the foreseeable future. B'
, the copy ofB
withinA
will continuously evolve, but over time diverge substantially fromB
, also because its use withinA
follows different requirements.B'
must maintain private. It should not be pushed into or synchronized withB
.B
must remain public, it must maintain its history and the links with its public forks.
I am aware of git submodule
. However, I do not intend to synchronize with the public repository after the fork. In particular, changes to B'
will be proprietary. In my understanding, changes within a submodule will normally have the same visibility as the original content of the submodule, so that would not work in my case.
NB: Similar questions:
- GitHub: How to fork a public repository as a subdirectory in a private repository?
- Public and private code in a single Git repository
- How do I clone someone else's GitHub repo as a subdirectory of my repo?
Their gist: Use submodule
. Is there any alternative?
The only idea I had so far was to revoke the visibility of B
to private and put a fresh copy into a new repository with the same URL, but that would detach existing public forks of B
and probably kill the history of B
.