Creates a branch. By default, Driftstone copies the repository main head and optional transforms can patch files after the copy. Set deriveFromMain to false to create only the branch record before uploading its first directory.
| Field | Location | Required | Description |
|---|
| repo | path | yes | Repository identifier. |
| name | body | yes | New branch name. |
| storageDir | body | conditional | Branch storage directory. Required when deriveFromMain is true. |
| deriveFromMain | body | no | Whether to copy from the repository main head. Defaults to true. Set false to create only the branch record. |
| message | body | no | Optional branch creation message. |
| transforms | body | no | Optional file transforms applied after copying the repository main head. |
| archive | body | no | Whether to archive the copied branch directory. Defaults to true. |
| page | query | no | List page number. Defaults to 1. |
| pageSize | query | no | List page size. Defaults to 10. |
curl -X POST "https://api.driftstone.ai/v1/repos/hello-world/branches" \
-H "Authorization: Bearer dk-..." \
-H "Content-Type: application/json" \
-d '{
"name": "feature-readme",
"storageDir": "state-123",
"deriveFromMain": true,
"transforms": {
"README.md": "# Branch-specific README\n"
}
}'curl -X POST "https://api.driftstone.ai/v1/repos/hello-world/branches" \
-H "Authorization: Bearer dk-..." \
-H "Content-Type: application/json" \
-d '{
"name": "profile-123",
"deriveFromMain": false
}'