| name | split-jj-changeset |
| description | jj split, mixed changeset, atomic revision, reviewed history: split a jj changeset into atomic focused changesets without interactive commands. Use in Jujutsu clones whenever one changeset mixes multiple intents. |
Split a jj Changeset
Split the changeset $ARGUMENTS into smaller, atomic units.
If $ARGUMENTS is empty, ask the user which revset to split.
Follow
commit-guidelines
for dirty-worktree decisions, checkpoint strategy, and reviewed-history
preservation.
Core safety principle
Never edit the original changeset directly. Duplicate first:
jj duplicate <revset>
Only abandon the original after the split is verified.
Workflow
- Inspect the changeset.
- Plan the grouping and validation with the user.
- Duplicate the original.
- Split by file path or reconstruct partial files for mixed hunks.
- Set descriptions.
- Verify completeness and correctness.
- Rebase dependents if needed.
- Clean up the original.
Target outcome
The goal is not only smaller changesets, but atomic changesets that satisfy the
revision rules in commit-guidelines.
Inspect the changeset
jj diff -r <revset> --stat
jj diff -r <revset>
jj log -r <revset>
Summarize the logical groups before changing anything.
Apply the grouping rules from
commit-guidelines
before choosing split boundaries.
Plan with the user
Before proceeding, confirm:
- how to group the changes
- what description each resulting changeset should have
- how to validate each changeset
For mixed hunks within a file, ask the user how those hunks should be assigned.
Split strategies
File-path split
When each file belongs to one group:
jj split -r <rev> <paths...>
Repeat on the remainder until each group is isolated.
Hunk-level split
When one file contains multiple logical groups:
- Create empty changesets off the parent.
- Restore whole files from the duplicate where possible.
- Reconstruct partial files by applying only the intended hunks.
- Write the resulting file content into the appropriate changeset.
Do not use jj split -i.
Verification
Completeness
jj interdiff --from <original-revset> --to <last-split-revset>
The combined split should match the original.
Correctness
Run the validation plan agreed with the user. It is usually enough to run:
just check
Use narrower crate-level commands when appropriate during iteration.
Cleanup
After verification, ask whether to abandon the original duplicate source:
jj abandon <original-revset>
Rules
- Never use interactive jj commands.
- Never pass
--ignore-immutable to a jj command.
- Duplicate first.
- Ask the user before choosing logical groupings.
- Verify both completeness and correctness before cleaning up.