Skip to content

FR: Support .jj redirect file for workspace repo discovery #10058

Description

@Buttars

Is your feature request related to a problem? Please describe.
When using jj workspaces to replicate a bare+worktree layout, there is no lightweight marker file in the workspace directory that indicates where the repo root lives. Tooling (editors, shell prompts, scripts) that look for a .jj directory to identify repo boundaries won't find one in the workspace, making the layout harder to discover and work with automatically.

Describe the solution you'd like
Support a .jj file (not directory) in a workspace directory that contains a path to the repo root, mirroring how Git resolves a gitdir file. When jj encounters a .jj file, it would read the path and use that as the repo root instead of searching parent directories.

Example layout:

my-project/
├── .repo/        ← jj repo root (.jj/ directory lives here)
├── main/
│   └── .jj       ← contains: ../.repo
└── feat-1/
    └── .jj       ← contains: ../.repo

Running jj status inside my-project/main/ would resolve the repo at my-project/.repo/ without needing to pass --repo explicitly.

Describe alternatives you've considered

  • Passing --repo explicitly on every command — works but is not ergonomic and requires the user to always know the relative path to the repo root.
  • Running commands from inside .repo/ — defeats the purpose of having separate workspace directories.
  • jj's existing workspace linkage stored inside .repo/.jj/ — functional, but produces no discoverable artifact in the workspace itself.

Additional context
This mirrors the pattern many Git users rely on when using bare repos with worktrees, where a gitdir file (e.g. echo "gitdir: ../.repo" > .git) makes each worktree self-describing. Supporting the same convention in jj would make migration from that workflow seamless and enable the same class of tooling integrations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions