Skip to main content
Version: 0.1.0

Working with Branches

Branches let you work on changes in isolation before merging to main. A branch forked with fromBranch is a full copy of the source — its nodes, indexes, and schema (archetypes, element types, node types) — so you can write archetyped content to it immediately.

Create a Branch

JavaScript Client

// Fork a branch from main's HEAD (copies schema + content)
await db.branches().create('feature-xyz', { fromBranch: 'main' });

See the Branches SDK reference for the full API.

HTTP API

curl -X POST \
http://localhost:8080/api/management/repositories/default/myapp/branches \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "feature-xyz",
"from_branch": "main",
"description": "Feature XYZ development"
}'

List Branches

curl http://localhost:8080/api/management/repositories/default/myapp/branches \
-H "Authorization: Bearer TOKEN"

Switch Branch

JavaScript Client

const featureWs = db.workspace('content').onBranch('feature-xyz');

await featureWs.nodes().create({
type: 'Article',
path: '/articles/new-feature',
properties: { title: 'New Feature' }
});

Via API Path

# Create node on feature branch
curl -X POST \
http://localhost:8080/api/repository/myapp/feature-xyz/head/content/articles/test \
-H "Authorization: Bearer TOKEN" \
-d '{"node_type": "Article", "properties": {"title": "Test"}}'

Delete a Branch

curl -X DELETE \
http://localhost:8080/api/management/repositories/default/myapp/branches/feature-xyz \
-H "Authorization: Bearer TOKEN"

Deploy a Package to a Branch

The CLI can upload and install a package onto any branch with --branch:

# Deploy schema + content to a `staging` branch (not main)
raisindb deploy ./package --repo myapp --branch staging --install

deploy, sync, and install all accept -b, --branch <name> (default main). See the CLI commands reference.

Next Steps