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 Case | Benefit |
|---|---|
| Staging Content | Prepare content for future release |
| Content Review | Get approval before publishing |
| Parallel Work | Multiple editors work independently |
| Safe Experimentation | Try changes without risk |
| Campaign Coordination | Batch 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-campaignThe branch will appear in TinaCloud within seconds.
Switching Branches in TinaCloud
- Open the TinaCloud editor
- Click the branch selector in the top navigation
- Select your target branch
- 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)
- Go to GitHub
- Create a Pull Request from your branch to main
- Review changes (content diff visible in the PR)
- Merge the PR
- Your site rebuilds with new content
Option 2: Git Command Line
git checkout main
git merge content/summer-campaign
git push origin mainBranch Strategies
Simple: Main + Staging
Two branches for most teams:
main (production)
|
+-- staging (review)
|
+-- Edit here, merge when approvedCampaign-Based
main (production)
|
+-- content/q1-launch
+-- content/blog-refresh
+-- content/new-productEnvironment-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 pushContent 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.