jujutsu.md

 1jj has no native support for the patch workflows (`format-patch` / `am`) that pr.pico.sh relies on. Its flow only works reliably in **colocated** jj repos (where `.git/` exists alongside `.jj/` at the workspace root).
 2
 3## Ensure colocation
 4
 5Run these checks from the jj workspace root (`jj root`) before doing anything else.
 6
 7```console
 8# Check whether you're in the root.
 9pwd && jj root
10
11# If not, prefix commands with
12cd $(jj root) && ...
13
14jj git colocation status
15
16# If the repo is not colocated, enable it
17jj git colocation enable
18```
19
20**STOP** if `jj git colocation enable` fails or is unavailable (jj < 0.28). The `git format-patch` / `git am` workflow will not work reliably without colocation. Ask the user how they would like to proceed.
21
22## Contributing
23
24Once colocated, the workflow mirrors the git-based contributing flow. Use jj for all VCS work except generating and applying patches.
25
26```console
27# Make changes with jj as usual (describe, new, split, squash, etc.)
28# When ready, ensure jj's state is exported to git (automatic in colocated repos)
29
30# Create a new patch request
31git format-patch origin/main --stdout | ssh pr.pico.sh pr create {repo}
32
33# Apply reviewer feedback
34ssh pr.pico.sh pr print {id} | git am -3
35
36# Submit a revision to an existing PR
37git format-patch origin/main --stdout | ssh pr.pico.sh pr add {id}
38
39# Submit a revision with a comment
40git format-patch origin/main --stdout | ssh pr.pico.sh pr add --comment "addressed feedback" {id}
41```
42
43After running `git am -3`, jj will automatically detect the new commits on its _next_ snapshot (meaning a subsequent `jj` command is required). You can run `jj log` to confirm they appear.
44
45## Reviewing
46
47```console
48# Apply patches from a PR (and update the jj snapshot)
49ssh pr.pico.sh pr print {id} | git am -3 && jj log
50
51# Submit a review (comments/changes as commits)
52git format-patch origin/main --stdout | ssh pr.pico.sh pr add --review {id}
53
54# Accept a PR
55ssh pr.pico.sh pr accept {id}
56
57# Submit final patchset and accept in one step
58git format-patch origin/main --stdout | ssh pr.pico.sh pr add --accept {id}
59
60# Prep and push to upstream
61jj rebase -d main  # or the appropriate trunk bookmark
62jj git push
63```