↓ Skip to main content
  1. Posts/

Ferry

Table of Contents

Stacked pull requests for jj on Forgejo, with no branches to manage.

Ferry icon
Coming soon Go CLI • jj 0.46+ • Forgejo v16 • MIT

Ferry works, but the source isn't public yet.

Ferry takes a stack of jj changes to Forgejo for review and lands them when they’re ready. Each change becomes its own pull request. There are no branches or bookmarks to name: a pull request is found by its change’s ID, so rewriting, rebasing or re-describing a change and uploading again updates its PR. Landing is fast-forward only, so the commit on main is your commit, and jj sees your change land instead of a copy of it.
ferry upload      # push the stack; create or update one PR per change
ferry status      # show the stack with each PR's state
ferry land        # merge ready changes, bottom-up

Highlights at a Glance
#

One PR per Change

Every change in the stack gets its own pull request, keyed by its jj change ID. The change’s description is the PR: first line the title, the rest the body, kept in sync on every upload.

No Branches

Ferry uses Forgejo’s AGit flow, which creates a PR from a pushed commit without any branch. Nothing to name, nothing to clean up, no bases to retarget.

Lands Bottom-Up, Fast-Forward Only

land merges the bottom change once it has its approvals and passing CI, and --all keeps going up the stack. The PRs above shrink by themselves; nothing is re-pushed.

Stack Comments for Reviewers

Each PR in a stack gets a comment listing the whole stack, with a link to its own commit, so reviewers know to look only at that one.

Status at a Glance

status shows the stack like jj log, with each PR’s state: needs upload or up to date, approvals, CI. It warns when your trunk is behind and finds PRs whose change is gone.

No State of Its Own

Everything comes from jj and Forgejo, so running ferry again is always safe. It reads jj through JSON templates and checks the whole stack before pushing anything.

Why Ferry?
#

Branch-based tools for stacked PRs have to translate jj’s model (stable changes, cheap rewrites) into the forge’s model (named branches, base and head pairs). Most of their complexity is in that translation: inventing bookmark names, retargeting PR bases, and reconciling the stack after a squash merge gives a commit a new identity.

Ferry avoids the translation instead of managing it. One PR per change, keyed by the change ID. Every PR targets main, so there are no bases to retarget. And landing keeps the commit, so jj never sees a stranger’s copy of your change on main.


How It Works
#

1. Upload
#

Ferry checks the stack first: every change needs a description, the stack must be linear, and no change may be empty, conflicted, or divergent. Then it pushes each change bottom-up as an AGit pull request with topic ferry/<change ID>, skipping changes whose PR already has the commit. --draft marks the PRs as work in progress.

2. Review
#

Every PR targets main, so its diff includes the changes below it; the stack comment points reviewers at the one commit that’s theirs.

3. Land
#

land merges the bottom change if its PR is ready: up to date, not a draft, approved as the branch requires, and CI green. Otherwise it says why and stops. If main has moved, it rebases the stack, uploads it again, and lets CI run before merging. If anything changes between its checks and the merge, it starts over.


Configuration
#

Ferry has no config file. Its settings live in jj’s config under ferry., per repository: the remote, the target branch, the Forgejo API URL, and the environment variable holding the API token. To run it as jj ferry, add an alias in jj’s user config.


Limitations
#

  • Forgejo only. AGit flow is specific to Forgejo (and Gitea, untested).
  • Linear stacks, single author. A Forgejo AGit PR belongs to whoever pushed it.
  • No interdiffs between PR revisions; Forgejo can’t show them for AGit PRs.
  • Signing: commits signed by jj as it creates them work; git.sign-on-push doesn’t yet.

Technology Stack
#

  • Language: Go 1.27, buildable with go build or Bazel
  • jj: read through JSON templates, never human-readable output (tested with jj 0.46)
  • Forgejo: AGit flow over git push, plus the Forgejo API for PRs, comments and merges (tested with v16)