# swarmops fetch

> Release: 0.11.0 · Last changed: 2026-10-22 · Source: https://github.com/KeiaiLab/SwarmOps/blob/stable/docs/reference/commands/fetch.md

Fetch a git remote into the store's mirror, and its followed branch into the store.

Git 2.39 or later fetches the remote's branches and tags into the store's mirror; the followed branch's commits become changesets, with no ref moved: main never moves. Run again with nothing new on the remote, it imports nothing. It needs no identity.

```yaml
title: "swarmops fetch"
description: "Fetch a git remote into the store's mirror, and its followed branch into the store."
group: "remotes"
since: "0.2.0"
mutates: true
identity_required: false
mcp_tool: "fetch"
envelope_op: "fetch"
exit_codes: [0]
errors: []
syntax: "swarmops fetch [OPTIONS] <REMOTE>"
```

## Syntax

```text
swarmops fetch [OPTIONS] <REMOTE>
```

## Required arguments

### `REMOTE`

Syntax: `<REMOTE>`.

The remote, by its name.

## Optional arguments

The command also takes the [global options](../cli.md#global-options).

## Examples

### CLI

No recorded example yet.

### MCP

No recorded example yet.

## Return information

`result` is a `FetchResp` (`swarmops schema FetchResp` prints its JSON Schema).

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `branch` | `string` | yes | The followed branch. |
| `branches` | `array of BranchUpdate` | yes | The remote branches that moved, appeared or went, at most 1,000. |
| `branches_truncated` | `boolean` | yes | Whether more branches moved than `branches` lists. |
| `head` | `RemoteHead or null` | no | The followed branch's head after the fetch; omitted when the remote has no such branch. |
| `imported` | `integer` | yes | How many changesets the import of the followed branch added. |
| `old_head` | `RemoteHead or null` | no | The followed branch's head as the last fetch saw it; omitted when none did. |
| `remote` | `string` | yes | The remote, by its name. |
| `tags_fetched` | `integer` | yes | How many tags the fetch brought into the mirror (they are never imported). |
| `warnings` | `array of string or null` | no | What the fetch has to say that did not stop it. Omitted when there is nothing. |

Envelope `op`: `fetch`.

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`](../errors.md#e_not_a_repo), [`E_IO`](../errors.md#e_io) or [`E_STORE_CORRUPT`](../errors.md#e_store_corrupt); a command line the grammar refuses is [`E_INVALID_ARG`](../errors.md#e_invalid_arg) (exit 2).

## See also

- [`swarmops clone`](clone.md)
- [`swarmops remote add`](remote-add.md)
- [`swarmops remote remove`](remote-remove.md)
- [`swarmops remote list`](remote-list.md)
- [`swarmops push`](push.md)
- [`swarmops sync`](sync.md)
- [`swarmops sync status`](sync-status.md)
- [CLI reference](../cli.md)
- [Error codes](../errors.md)
