Page kind: Reference
swarmops push#
Send a store ref to a remote branch by compare-and-swap, never by force: the remote moves only from the head the last fetch saw, to a descendant of it.
The ref is exported into the store's mirror on top of what the last fetch saw of the branch, so the export only appends, then git pushes it with a lease on that value. A remote that moved since fails with E_REMOTE_DIVERGED (exit 3) and nothing is sent: fetch, or sync. Run again, it sends nothing and starts no git. It needs no identity: a push is an export.
- Group
remotes- Since
0.2.0- Mutates
- yes
- Identity required
- no
- MCP tool
push- Envelope op
push- Exit codes
- 0
- Errors
- none
Syntax#
swarmops push [OPTIONS] <REMOTE> [REF[:BRANCH]]Required arguments#
Syntax: <REMOTE>.
The remote, by its name.
Optional arguments#
The command also takes the global options.
Syntax: <REF[:BRANCH]>.
What to send, as <ref>[:<branch>]: the store ref (main, the default, release/<name>, or in a FORMAT 2 store a branch (feature/x), not a tag) and the remote branch (by default the remote's followed branch for main, the same name for any other ref).
Examples#
No recorded example yet.
No recorded example yet.
Return information#
result is a PushResp (swarmops schema PushResp prints its JSON Schema).
| Field | Type | Required | Description |
|---|---|---|---|
branch | string | yes | The remote branch. |
head_changeset | string | yes | The changeset at the store ref's head. |
new | string | yes | The commit the branch names now: the export of head_changeset. |
objects_written | integer | yes | How many git objects the push's export wrote into the mirror. |
old | string or null | no | The commit the branch named before; omitted when it did not exist. |
remote | string | yes | The remote, by its name. |
rewritten | integer | yes | How many of the exported commits have another id than the commit they were imported from, as git export's rewritten. |
status | PushStatus | yes | What the push did. |
warnings | array of string or null | no | What the push has to say that did not stop it. Omitted when there is nothing. |
Envelope op: push.
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).