Cookbook
Cookbook
This guide provides practical “recipes” for common scenarios you’ll encounter while using jjj with Jujutsu.
1. Handling Merge Conflicts
When two solutions modify the same lines, Jujutsu will create a conflict. Here’s how to handle it in a jjj context.
- Identify the conflict:
jj statuswill show conflicted files. - Fix the code: Edit the files and resolve the conflicts using standard
jjpatterns. - Update the solution: If the fix was for a solution like “Use connection pooling”, your change is already attached.
- Critique the collision: If the conflict revealed a deeper architectural issue, add a Critique to one or both solutions.
Terminal window jjj critique new "connection pooling" "This approach conflicts with the caching solution's logic." --severity medium
2. Decomposing a Large Feature
Large features should be broken down into manageable problems.
- Create the parent problem:
Terminal window jjj problem new "Build new search infrastructure" - Decompose into sub-problems:
Terminal window jjj problem new "Implement elasticsearch indexing" --parent "search infrastructure"jjj problem new "Create search API endpoint" --parent "search infrastructure" - Solve independently: Team members can now propose solutions for “elasticsearch indexing” and “search API endpoint” in parallel.
3. Self-Review and Draft Critiques
You can use jjj to document your own thought process before presenting code for review.
- Propose your solution:
jjj solution new "Optimistic UI update" --problem "flaky network" - Critique your own work: Document edge cases you’re worried about.
Terminal window jjj critique new "Optimistic UI" "What happens if the network is flaky?" --severity low - Address it: Link your subsequent commits to addressing this critique.
- Signal readiness: When you request a review, the reviewer can see what you’ve already considered.
4. Switching Between Competing Solutions
If you’re trying two different approaches for the same problem:
- Propose both:
Terminal window jjj solution new "Approach A: GraphQL" --problem "API redesign"jjj solution new "Approach B: REST" --problem "API redesign" - Toggle with
jjj resume:Terminal window jjj solution resume "GraphQL" # Switches your jj workspace to this solution's change# ... work on GraphQL approach ...jjj solution resume "REST" # Switches your jj workspace to this solution's change - Refute the loser: Once one approach is proven better, refute the other with a rationale.
Terminal window jjj solution refute "GraphQL" --rationale "GraphQL introduced too much complexity for this use case."
5. Preparing for Code Review
Before requesting a review, use jjj to document your thinking so reviewers have context:
- Submit for review to signal it’s ready for criticism:
Terminal window jjj solution review "Add search index" - Add self-critiques for known concerns you haven’t fully resolved:
Terminal window jjj critique new "Add search index" "Index rebuild time on large datasets unknown" --severity medium - Assign a reviewer:
Terminal window jjj solution assign "Add search index" --reviewer @alice - Ask Alice to review: she runs
jjj statusand sees your solution in the REVIEW queue. When she raises a critique, you’ll see it in BLOCKED. When all critiques are resolved and she signs off, you canjjj submit.
6. Tracking a Milestone
When planning a release, use milestones to group problems and track progress:
- Create the milestone:
Terminal window jjj milestone new "v1.0 Launch" --date 2025-09-01 - Tag problems to the milestone:
Terminal window jjj problem edit "Search is slow" --milestone "v1.0"jjj problem edit "Auth missing" --milestone "v1.0" - Check progress:
This shows which problems are open, in-progress, and solved for each milestone, so you can assess scope and schedule risk.
Terminal window jjj milestone roadmap
7. Handling an Abandoned Solution
If a team member leaves or a solution goes stale, you can cleanly hand it off or close it:
- Check the current state:
Terminal window jjj solution show "Old approach" - Reassign to yourself to pick it up:
Terminal window jjj solution assign "Old approach" --mejjj solution resume "Old approach" # Switch your workspace to this change - Or refute it with a rationale if the approach is no longer viable:
Terminal window jjj solution refute "Old approach" --rationale "Superseded by the new caching architecture."
8. Using Search to Find Context
Use full-text or semantic search to find related work before starting something new:
# Full-text search across all entitiesjjj search "authentication"
# Semantic search (finds conceptually related even without exact match)jjj search "login security" --semantic
# Filter by typejjj search "token" --type solutionThis helps avoid duplicating work and surfaces critiques from previous related efforts.