Prerequisites
- TerminusDB running locally (install guide)
- A cloned database (clone guide)
What you'll achieve By the end of this guide, you will have pulled new commits from a remote branch into your local clone — like git pull for databases.
After cloning a database, the remote may receive new commits. Pull fetches those changes and merges them into your local branch.
Pull from a remote branch
Pull the enriched branch from the Star Wars public data server. This branch adds a Starship class and starship data:
Example: TypeScript
const pullEnrichedBranch = async () => {
client.remoteAuth({ type: "basic", user: "public", key: "public" })
const result = await client.pull({
remote: "origin",
remote_branch: "enriched",
message: "Pull enriched branch with starship data",
})
console.log("Pull result:", result)
}Example: Python
client.connect(user="admin", key="root", team="admin", db="star-wars")
result = client.pull(
remote="origin",
remote_branch="enriched",
message="Pull enriched branch with starship data",
remote_auth={"type": "basic", "user": "public", "key": "public"},
)
print("Pull result:", result)curl -u admin:root -X POST \
"http://localhost:6363/api/pull/admin/star-wars/local/branch/main" \
-H "Content-Type: application/json" \
-H "Authorization-Remote: Basic cHVibGljOnB1YmxpYw==" \
-d '{
"remote": "origin",
"remote_branch": "enriched"
}'After pulling, your local main branch now includes the Starship schema and data from the remote enriched branch.
Inspect what changed
After pulling, inspect the new data that arrived:
Example: TypeScript
const inspectChanges = async () => {
// Get recent commits to see what was pulled
const log = await client.getCommitHistory()
console.log("Recent commits:", log.slice(0, 3))
// Get all documents to see new starship data
const docs = await client.getDocument({ as_list: "true", type: "Starship" })
console.log("Starships:", docs)
}Example: Python
# View recent commits
commits = client.log(count=3)
print("Recent commits:", commits)
# Query the new Starship documents
starships = list(client.get_all_documents(graph_type="instance", type="Starship"))
print("Starships:", starships)# View recent commit log
curl -u admin:root \
"http://localhost:6363/api/log/admin/star-wars/local/branch/main?count=3"
# Get Starship documents
curl -u admin:root \
"http://localhost:6363/api/document/admin/star-wars/local/branch/main?type=Starship&as_list=true"Next steps
- Push changes — send your local modifications to a remote
- Time travel — inspect the state before the pull
- Reset — undo the pull by resetting to a previous commit