Skip to content

Add revert mode for jj revert - #15

Open
hugoh wants to merge 1 commit into
hackrdotsh:mainfrom
hugoh:add-revert-mode-for-tznrwxvx
Open

hugoh wants to merge 1 commit into
hackrdotsh:mainfrom
hugoh:add-revert-mode-for-tznrwxvx

Conversation

@hugoh

@hugoh hugoh commented Sep 26, 2026

Copy link
Copy Markdown

R in the log picks up the selected commit and reuses the rebase destination picker (onto/after/before) to run jj revert. The destination defaults to the working copy.

Summary

Adds jj revert to gojo: press R on a commit in the log, choose where the reverse should go (onto / after / before a destination), and press ⏎.

Why

gojo had no way to revert a commit. jj revert needs a destination and a placement (--onto / --insert-after / --insert-before), which are the same choices rebase mode already offers, so revert reuses that picker instead of adding a new mode.

Changes

  • Runner.Revert runs jj revert -r <src> <placement> <dest>; it supports the same retry-with-extra-flags path as rebase.
  • New revert log action bound to R, remappable as log.revert in [keymap].
  • Rebase mode gets a revert variant: the status bar shows [revert], the source is marked "● reverting", and the -r/-s scope toggle is disabled.
  • The destination starts on the working copy if it's in the log (it can be the reverted commit itself); otherwise it falls back to the neighboring commit, like rebase. Revert allows destination = source; rebase still rejects it.
  • execRebase now has one run path shared by rebase and revert.
  • R / revert appears in the help view, the log right-click menu and the shortcut bar.
  • CHANGELOG: entry under Unreleased → Added.

Checklist

  • go build ./... passes
  • go vet ./... passes
  • go test ./... passes
  • Tests added/updated for behavior changes (TestRevertModeFlow, TestRevertDefaultDestination, keymap resolution)
  • Docs updated (README / AGENTS.md / CONTRIBUTING.md) if relevant

R in the log picks up the selected commit and reuses the rebase
destination picker (onto/after/before) to run jj revert. The destination
defaults to the working copy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant