Tinacms Developer Docs

Branch-Based Editing

Edit content on Git branches for staging, review, and collaborative workflows

TinaCloud's branch-based editing lets you work on content changes without affecting your production site. Edit on a branch, preview changes, then merge when ready.

Why Use Branches?

Use CaseBenefit
Staging ContentPrepare content for future release
Content ReviewGet approval before publishing
Parallel WorkMultiple editors work independently
Safe ExperimentationTry changes without risk
Campaign CoordinationBatch related content changes

Setup

1. Configure Branch Detection

TinaCloud automatically detects your current branch. Configure your project to support this:

// tina/config.ts
import { defineConfig } from 'tinacms'

export default defineConfig({
  branch:
    process.env.TINA_BRANCH ||
    process.env.VERCEL_GIT_COMMIT_REF ||
    process.env.HEAD ||
    'main',

  clientId: process.env.TINA_CLIENT_ID,
  token: process.env.TINA_TOKEN,
  // ... rest of config
})

2. Deploy Preview Environments

For the best experience, set up preview deployments for each branch:

  • Vercel — Automatically creates preview deployments per branch
  • Netlify — Enable branch deploys in Site settings > Build & deploy
  • Other — Configure your CI/CD to deploy branches to unique URLs

Working with Branches

Creating a Content Branch

git checkout -b content/summer-campaign
git push -u origin content/summer-campaign

The branch will appear in TinaCloud within seconds.

Switching Branches in TinaCloud

  1. Open the TinaCloud editor
  2. Click the branch selector in the top navigation
  3. Select your target branch
  4. The editor reloads with that branch's content

Automatic Detection

When you access TinaCloud from a preview deployment URL, it automatically selects the matching branch.

Merging Content to Production

Option 1: GitHub Pull Request (Recommended)

  1. Go to GitHub
  2. Create a Pull Request from your branch to main
  3. Review changes (content diff visible in the PR)
  4. Merge the PR
  5. Your site rebuilds with new content

Option 2: Git Command Line

git checkout main
git merge content/summer-campaign
git push origin main

Branch Strategies

Simple: Main + Staging

Two branches for most teams:

main (production)
  |
  +-- staging (review)
        |
        +-- Edit here, merge when approved

Campaign-Based

main (production)
  |
  +-- content/q1-launch
  +-- content/blog-refresh
  +-- content/new-product

Environment-Based

main (production)
  |
  +-- staging (staging.yoursite.com)
        |
        +-- develop (dev.yoursite.com)

Handling Conflicts

Content conflicts can occur when the same content is edited on multiple branches or when main is updated while your branch is open.

Resolving Conflicts

git checkout your-branch
git merge main

# Resolve conflicts in your editor, then:
git add .
git commit -m "Resolve merge conflicts"
git push

Content Conflicts

TinaCloud edits are committed immediately. If two editors change the same content on the same branch, one may overwrite the other. Use editorial workflow for coordination.

Branch Protection

In GitHub, go to Settings > Branches > Add rule for main:

  • Enable "Require pull request reviews"
  • Optionally require status checks

Now direct edits to main require a PR.

On this page