Skip to content

Importing projects with external continuity #596

@tazjin

Description

@tazjin

I've been trying to figure out if there is a way to import an external project into a subtree and keep history continous for external consumers of that repo (i.e. let git pull work with a new josh-backed upstream on old checkouts). Ideally all commit hashes would also be preserved.

I've tried a couple of things, such as:

  1. Clone an empty josh workspace at the target path. Add the original remote there, reset to its HEAD, push back to josh with -o create. This creates a history where all the original commits are rebased on the history of the repository, in which case pulling is possible as long as rebasing on pulling is enabled.
    This is as close as I've gotten to doing what I want, but it loses all the original commit IDs, which is not ideal.
  2. Clone an empty workspace at the target path. Create an empty base commit, add the original remote, create a merge commit with it. Push back to josh with -o create. Josh flattens the merge commit and original history is lost.
  3. Create a placeholder file in the monorepo to ensure the path has an existing history. Clone it with josh, merge the history from the remote as above. History is lost again in the same way.

What I sort of expected: In the first version, I expected the push back to synthesize a merge commit with the original history instead of rebasing the commits on top of it.

Any ideas on how to accomplish this? If we figure it out I'll contribute some docs for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions