| name | jj-new-since-push |
| description | Create a new child revision and move all changes made since the last push into it, leaving the pushed revision clean. |
| allowed-tools | ["Agent"] |
New Revision Since Push
Create a new child revision and move all changes made since the last push into it, leaving the pushed revision clean.
CRITICAL: Conversation context may contain stale jj state (old diffs, descriptions, logs). You MUST dispatch a subagent to inspect the live jj state directly. Do NOT rely on any jj output already in the conversation.
Execution
Spawn a subagent with the following prompt:
You are moving post-push jj changes to a new child revision. Inspect the LIVE state — do not trust any prior context.
1. Run `jj log -r @ -T 'bookmarks'` to get bookmarks on current revision.
- If output is empty, report error: "No bookmark found on current revision. Use `jj bookmark create <name>` to create one." and stop.
- Extract the bookmark name (use the first one if multiple exist).
2. Run `jj diff -r '<bookmark-name>@origin..@' --stat` to check for changes since push.
- If output is empty (no changes since push):
- Run `jj new` to create a new child revision
- Report: "No changes since last push. Created new child revision."
- Stop here.
3. Move post-push changes to new revision:
- Get the current revision ID: `jj log -r @ -T 'commit_id' --no-graph`
- Get the old bookmark commit ID: `jj log -r <bookmark-name> -T 'commit_id' --no-graph`
- Move the bookmark back to origin: `jj bookmark set <bookmark-name> -r <bookmark-name>@origin --allow-backwards`
- Create new child revision: `jj new <bookmark-name>`
- Restore changes from the saved current revision ID: `jj restore --from <current-rev-id>`
- Abandon the old bookmark commit: `jj abandon <old-bookmark-commit-id>`
- Report: "Moved post-push changes to new child revision. Parent revision now matches remote."
Always use `jj` commands, never `git`.
The bookmark name should be the local bookmark (without `@origin`).
The `--allow-backwards` flag is required when moving a bookmark to an ancestor.
After the subagent returns, report the result to the user.