Page kind: Reference
swarmops rebase#
Merge a change three-way onto a ref's head and record the result there as one changeset, moving no ref.
The change is HEAD with its first-parent chain since the base, merged as land merges it; the new changeset's parent is the ref's head, and the ref stays where it is. Build and test that changeset, then land it with --expect-target set to the head it was rebased onto: the landed tree is then the tested one. A conflict is E_CONFLICT (exit 3), as a land's, and nothing is recorded.
- Group
write- Since
0.3.0- Mutates
- yes
- Identity required
- yes
- MCP tool
rebase- Envelope op
rebase- Exit codes
- 0
- Errors
- none
Syntax#
swarmops rebase [OPTIONS] <HEAD>Required arguments#
Syntax: <HEAD>.
The changeset to rebase: the change's head.
Optional arguments#
The command also takes the global options.
Syntax: --base <REV>.
Where the change starts: a first-parent ancestor of HEAD (default: the merge base of HEAD and the ref's head, along first parents).
Syntax: --onto <REF>.
Default: main.
The ref to rebase onto: main or release/<name>, and in a FORMAT 2 store a branch (feature/x) or a tag (tags/v1).
Syntax: -m, --message <MSG>.
The new changeset's message (default: HEAD's).
Syntax: --key <UUID>.
A uuid v7 that makes a retry safe: the same rebase onto the same head replays (status: replayed).
Syntax: --max-conflict-bytes <N>.
Default: 32768.
The most bytes of hunk text an E_CONFLICT report carries, as land's.
Syntax: --resolve <FILE>.
Resolve the conflicts an E_CONFLICT report named, without a checkout: resolutions as a JSON object in FILE, or - for stdin, at most 64 MiB (swarmops schema ResolutionsInput).
{"against": THEIRS, "files": {PATH: RESOLUTION, ...}}: THEIRS is the report's theirs, by its full id, and each RESOLUTION one of {"take": "ours"}, {"take": "theirs"}, {"content": CONTENT} with an optional "mode" (CONTENT as a commit's change gives it: inline, base64, a file, or a stored blob by id) and {"delete": true}. A resolution decides its path and every path below it; the rest of the merge stands.
A resolution applies while the ref holds its path as THEIRS did, whether the path conflicts or not. A path the ref changed since is stale: the land fails with E_CONFLICT again, its report naming the path in stale, as it does for each conflict left unresolved. Read the report's theirs, and resolve against it.
Examples#
No recorded example yet.
No recorded example yet.
Return information#
result is a RebaseResp (swarmops schema RebaseResp prints its JSON Schema).
| Field | Type | Required | Description |
|---|---|---|---|
auto_merged | array of string | no | The paths both sides changed whose contents merged cleanly into a content neither side had. Omitted when empty. |
base | string | yes | The changeset the change was taken from. |
changeset | string | yes | The changeset that holds the result: the recorded one, head when it is up to date, the ref's head when the change was absorbed. |
files_changed | integer | yes | How many paths changeset changes against onto. |
onto | string | yes | The ref's head the change was merged onto: changeset's parent when one was recorded. |
root | string | yes | The root tree of changeset. |
status | RebaseStatus | yes | How the rebase ended. |
Envelope op: rebase.
Exit codes:
0: Success.
Errors#
No golden step shows this command failing yet.
Any command that opens a store may also fail with a store error, such as E_NOT_A_REPO, E_IO or E_STORE_CORRUPT; a command line the grammar refuses is E_INVALID_ARG (exit 2).