Skip to content

Git subtree merge changes project ID (making history inaccessible) #12103

@michalrus

Description

@michalrus

Description

Since the project ID is based on the initial commit:

git rev-list --max-parents=0 --all

… once you perform a Git subtree merge, to merge a smaller repository as a subdirectory of the larger monorepo, it will potentially change the project ID (depending on which repository is newer).

The new project ID is then also the initial commit of the smaller repository, so now you share session history between the smaller repository and the monorepo, after the subtree merge.

I understand how and why this occurs, but it’s a little confusing. Perhaps if there were more than one root commit, something else should happen.

Plugins

none

OpenCode version

1.1.47

Steps to reproduce

  1. Open a project, start a session.
  2. Now either:
    • merge another repo as a subdirectory of this one: git subtree add --prefix=subdir other-remote other-branch,
    • or just add another root to the commit tree: git switch --orphan orphan and commit something.
  3. Reopen the project – the session history is gone.

Screenshot and/or share link

No response

Operating System

Linux

Terminal

Alacritty

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions