jj-workspace

Create and delete jj workspaces as git worktrees with isolated submodule state.

6.2k|596|Updated May 5, 2016
One-click install
npx skills add https://github.com/RediSearch/RediSearch --skill jj-workspace
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: jj-workspace
Source: https://github.com/RediSearch/RediSearch/tree/main/.skills/jj-workspace
Command: npx skills add https://github.com/RediSearch/RediSearch --skill jj-workspace

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Jujutsu (jj) does not support git submodules, so a plain jj workspace add in a submodule-heavy repository like RediSearch produces a checkout that cannot build. Naively sharing the main checkout's .git directory corrupts submodule configuration across every checkout on the machine. This Skill provides a verified procedure for creating and safely deleting jj workspaces that are registered as real git worktrees with their own HEAD, index, and submodule metadata.

Core Features & Use Cases

  • Workspace creation: Five-step procedure that creates a jj workspace, stages and attaches a git worktree, points HEAD at the workspace's own commit, and initialises the five submodules (deps/VectorSimilarity, deps/googletest, deps/hiredis, deps/libuv, deps/snowball) recursively.
  • HEAD re-sync: Re-points the frozen git HEAD and re-checks submodules after the workspace's @ moves, so builds stamp the correct commit and make fetch checks out the pinned submodule revisions.
  • Guarded deletion: Refusal-based teardown that verifies jj knows the workspace, refuses the repository-hosting workspace, checks for uncommitted or unpushed work in the working copy and submodules, then forgets the workspace and removes the worktree in one scoped step.
  • Use Case: You need to leave a long RediSearch build or test run undisturbed while working on a fix in parallel. Create a RediSearch-<feature> workspace side by side, build and test there concurrently without contending on the Cargo build-directory lock, then clean it up when the task is done.

Quick Start

Create a new jj workspace named RediSearch-my-feature so I can build and test in parallel with this checkout.

Frequently Asked Questions about jj-workspace

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a jj workspace with git submodules?

Create the jj workspace with `jj workspace add --revision master --sparse-patterns full`, then stage a git worktree elsewhere with `git worktree add --no-checkout --detach`, move its `.git` pointer into the workspace, run `git worktree repair`, point HEAD at the workspace commit, and run `git submodule update --init --recursive` on the explicit submodule paths.

Why does jj not support git submodules in workspaces?

The jj documentation states submodules are not supported: they do not appear in the working copy. Sharing the main checkout's `.git` directory instead corrupts the shared per-submodule config, checks out submodules at the wrong pinned revisions, and makes builds stamp the main checkout's commit.

How do I safely delete a jj workspace without losing work?

Derive the workspace path from `jj workspace root --name`, refuse if `.jj/repo` is a directory (the hosting workspace), verify the working-copy commit is empty and no submodule reports `-`, `+`, or `U`, then run `jj workspace forget` followed by `git worktree remove --force`. Never run `git worktree prune` or `git submodule deinit`.

Why does my jj workspace build report the wrong commit?

The workspace's git HEAD is a frozen snapshot set at creation, and CMake embeds `git describe` output into the module. After the workspace's `@` moves, re-sync with `git update-ref --no-deref HEAD`, `git reset --mixed`, and a recursive submodule update before building.

When should I use a jj workspace instead of jj new?

Use a workspace only when you need a second checkout side by side with the current one, such as leaving a long build or test run undisturbed. For simply starting new work, `jj new` is sufficient because each workspace carries its own build output directories.