# push\_worktree

Push a task's branch to origin under its own name.

writes · not idempotent · destructive · CLI only · [Agent](https://komrad.dev/latest/api/agent.md)

Komrad overwrites origin's copy after a rebase only when nothing on origin would be lost.

## Calling it

```bash
curl -X POST http://127.0.0.1:8787/komrad.agent.v1.AgentService/PushWorktree \
  -H 'Content-Type: application/json' \
  -d '{
  "task_id": "<task_id>"
}'
```

```bash
komrad rpc push-worktree \
  --task-id '<uuid>'
```

## Request

### PushWorktreeRequest

| Field | Type | Description |
| --- | --- | --- |
| [one of](https://komrad.dev/latest/api/agent/push-worktree.md#komrad-agent-v1-PushWorktreeRequest-task)\* |  | The task whose branch to push to origin. |
| [`task_id`](https://komrad.dev/latest/api/agent/push-worktree.md#komrad-agent-v1-PushWorktreeRequest-task_id) | uuid | The task, by id. |
| [`task_slug`](https://komrad.dev/latest/api/agent/push-worktree.md#komrad-agent-v1-PushWorktreeRequest-task_slug) | string not empty | The task, by slug. |

## Response

### PushWorktreeResponse

| Field | Type | Description |
| --- | --- | --- |
| [`branch`](https://komrad.dev/latest/api/agent/push-worktree.md#komrad-agent-v1-PushWorktreeResponse-branch) | string | The branch that was pushed. |
| [`commits`](https://komrad.dev/latest/api/agent/push-worktree.md#komrad-agent-v1-PushWorktreeResponse-commits) | int32 | How many commits were pushed. |
| [`forced`](https://komrad.dev/latest/api/agent/push-worktree.md#komrad-agent-v1-PushWorktreeResponse-forced) | bool | Whether origin's copy was overwritten. |
| [`sha`](https://komrad.dev/latest/api/agent/push-worktree.md#komrad-agent-v1-PushWorktreeResponse-sha) | string | The commit origin's copy of the branch now points at. |
