# dev.knotless.createCommit

> Published by [lexicons.knotless.dev](https://lexicon.garden/identity/did:plc:yqsg7znbbhfmj3a2nrpnaerk)

✓ This is the authoritative definition for this NSID.

## Description

Commits file changes to a branch through a gateway its owner has delegated writes to, without a clone. Commits to one branch that arrive together are built into one chain and written as one ref update. Requires a service token from the caller's PDS, audience the gateway's DID, for this method; the caller must be the owner or a collaborator.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.createCommit)
- [Documentation](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.createCommit/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.createCommit/examples)

## Definitions

### `dev.knotless.createCommit#author`

**Type**: `object`

Who the commit names as its author, when not the gateway's default.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `email` | `string` | Yes |  |
| `name` | `string` | Yes |  |

### `dev.knotless.createCommit#change`

**Type**: `object`

One path written or deleted.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `data` | `bytes` | No | The file's new contents; absent to delete it. |
| `executable` | `boolean` | No |  |
| `path` | `string` | Yes | Relative to the repository root. |

### `dev.knotless.createCommit`

**Type**: `procedure`

Fails with 409 when a change touches a path that moved since `base`, or when the branch kept moving under the batch.

#### Input

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `author` | `ref` → `#author` | No |  |
| `base` | `string` | No | The hex object ID of the commit the changes were made against. Without it the changes apply to whatever the branch holds. |
| `branch` | `string` | Yes | Without refs/heads/. Created when absent, from `base`, or else from the default branch's tip. |
| `changes` | `array` | Yes |  |
| `message` | `string` | Yes |  |
| `name` | `string` | Yes | The repository's name: its dev.knotless.repo record key. |
| `repo` | `string` (did) | Yes | The repository's owner. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `batched` | `integer` | Yes | How many commits went out in the write that carried this one. |
| `changed` | `boolean` | Yes | False when the changes left the tree as it was, and no commit was made. |
| `parent` | `string` | No | The hex object ID the commit was built on; absent for a branch's first commit. |
| `sha` | `string` | Yes | The hex object ID of the commit, or of the branch tip when nothing changed. |

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "author": {
      "description": "Who the commit names as its author, when not the gateway's default.",
      "properties": {
        "email": {
          "maxLength": 1000,
          "type": "string"
        },
        "name": {
          "maxLength": 1000,
          "type": "string"
        }
      },
      "required": [
        "name",
        "email"
      ],
      "type": "object"
    },
    "change": {
      "description": "One path written or deleted.",
      "properties": {
        "data": {
          "description": "The file's new contents; absent to delete it.",
          "type": "bytes"
        },
        "executable": {
          "default": false,
          "type": "boolean"
        },
        "path": {
          "description": "Relative to the repository root.",
          "maxLength": 4096,
          "type": "string"
        }
      },
      "required": [
        "path"
      ],
      "type": "object"
    },
    "main": {
      "description": "Fails with 409 when a change touches a path that moved since `base`, or when the branch kept moving under the batch.",
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "author": {
              "ref": "#author",
              "type": "ref"
            },
            "base": {
              "description": "The hex object ID of the commit the changes were made against. Without it the changes apply to whatever the branch holds.",
              "maxLength": 64,
              "minLength": 40,
              "type": "string"
            },
            "branch": {
              "description": "Without refs/heads/. Created when absent, from `base`, or else from the default branch's tip.",
              "maxLength": 255,
              "type": "string"
            },
            "changes": {
              "items": {
                "ref": "#change",
                "type": "ref"
              },
              "type": "array"
            },
            "message": {
              "maxLength": 20000,
              "type": "string"
            },
            "name": {
              "description": "The repository's name: its dev.knotless.repo record key.",
              "maxLength": 100,
              "type": "string"
            },
            "repo": {
              "description": "The repository's owner.",
              "format": "did",
              "type": "string"
            }
          },
          "required": [
            "repo",
            "name",
            "branch",
            "message",
            "changes"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "batched": {
              "description": "How many commits went out in the write that carried this one.",
              "minimum": 0,
              "type": "integer"
            },
            "changed": {
              "description": "False when the changes left the tree as it was, and no commit was made.",
              "type": "boolean"
            },
            "parent": {
              "description": "The hex object ID the commit was built on; absent for a branch's first commit.",
              "maxLength": 64,
              "minLength": 40,
              "type": "string"
            },
            "sha": {
              "description": "The hex object ID of the commit, or of the branch tip when nothing changed.",
              "maxLength": 64,
              "minLength": 40,
              "type": "string"
            }
          },
          "required": [
            "sha",
            "changed",
            "batched"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "description": "Commits file changes to a branch through a gateway its owner has delegated writes to, without a clone. Commits to one branch that arrive together are built into one chain and written as one ref update. Requires a service token from the caller's PDS, audience the gateway's DID, for this method; the caller must be the owner or a collaborator.",
  "id": "dev.knotless.createCommit",
  "lexicon": 1
}
```
