Stacked Changes
Stacked changes are JJHub’s premiere feature and a core reason to use jj over git. They’re essential for AI workflows, where agents naturally produce incremental, dependent changes at machine speed.Why Stacked Changes?
In git, managing dependent branches requires constant rebasing, conflict resolution, and force-pushing. Each rebase produces new commit hashes, breaking downstream references. In jj:- Rebase is automatic - edit any change in the stack and descendants rebase seamlessly
- Change IDs are stable - no matter how many times you rewrite, the Change ID persists
- Conflicts are tracked - if a rebase creates a conflict, jj records it rather than blocking
Creating a Stack
jj new creates a child change. The result is a linear stack:
Viewing the Stack
Usejj log to see your stack:
Pushing a Stack
Push all bookmarks (and the stack) to JJHub:Landing a Stack
Create a landing request for the entire stack:--stack flag automatically detects all changes in the stack and includes their Change IDs. The landing request will display:
stack_size- number of changes in the stackchange_ids- the stable IDs for every change
Editing a Change Mid-Stack
One of jj’s strengths is editing any change in the stack without disrupting the rest:Stacked Changes and AI Agents
Stacked changes are essential for AI workflows:- An agent produces a plan as a sequence of incremental changes
- Each change is a discrete, reviewable unit
- The human reviews the plan (the stack structure) rather than line-by-line diffs
- The agent executes, producing the full stack
- CI validates each change independently
- The stack lands as a unit via
jjhub land merge