Skip to main content
A branch is a private copy of a Site with its own address. You publish to it, check it, and then promote it to make it the Site’s live version. The Site itself doesn’t change until you promote. A Site can have several branches. staging is the first one, and you can add named ones beside it, such as holiday-homepage. Each branch has its own address, git branch and database. A new branch starts from live, or from another branch, the way a git branch starts from another.
Several branches need member Sites and site branches turned on by Fluid for your company. Site branches turns on staging by itself, so you don’t ask for staging as well. To ask for it, contact support. Without site branches, a Site keeps one branch, and these things work as they did before:
  • Only main is a reserved name.
  • A branch’s database is copied with its rows, in the background. See The branch’s database.
  • A branch counts toward a member’s limit of 25 Sites.
  • A branch’s functions get no settings from the Site.
  • Fluid doesn’t check what is live when it undoes a promote, and a rollback doesn’t update main.
  • An undo never puts the database back. See Undo a promote.
  • A branch’s database can’t be reset, so it can’t be given live’s rows.
  • A new branch can’t start from another branch. It starts from live.
  • fluid sites branch update doesn’t check the schema, and a promote doesn’t plan it before main moves.
This page covers the whole flow. Source and branches has the short version. In Mist, see Source Control for a Site.

Make a branch

Run it in the Site’s folder. The Site must be published, must not be taken down, and can’t itself be a branch. The command says which branch or live the new one started from, and prints the branch’s address. See Start from another branch for --from.
  • A name is a slug. Use lowercase letters and digits, with single hyphens between them, at most 40 characters. holiday-homepage works. Holiday_Homepage and holiday--homepage don’t.
  • Some names are reserved. main, live, production and master are refused.
  • A name is used once per Site. A second holiday-homepage is refused with “A branch named holiday-homepage already exists”.
  • A Site holds a limited number of branches, staging included. The Site’s branch list returns the limit as branch_limit. It is currently 10, and 1 for a company without site branches. Past it, a create is refused with “This site already has 10 branches; delete one first”. Delete a branch to make room. A Site made under the earlier limit of 15 keeps the branches it has. Only a new branch is refused.
  • A branch costs no Site slot. A member who owns 25 Sites can still branch them.
The Site’s owner and a company admin can make and delete branches, and so can an editor of a member’s Site, while your company has site branches or staging turned on. A branch opens for the Site’s owner, company admins and editors, never for visitors. Search engines never index it. A branch made before Fluid gave each branch its own git branch has none. While your company has site branches but not the older staging setting, only the Site’s owner and company admins can use such a branch. A branch you make again gets its own git branch and is shared with editors. A new branch starts from live’s published version, with live’s tables and no rows, unless you start it from another branch. Edits in your folder that you haven’t published aren’t in it. With site branches turned on, it is ready when the command answers, and its status is published. If Fluid can’t finish setting it up in that time, the status is draft, and Fluid finishes it in the background. The command says the files are still being copied, and publishing to the branch fails with copy_in_progress until then.

Start from another branch

A new branch can start from any other branch of the Site, not only from live.
--from <branch> names the branch to start from. --from live starts from the live Site, and main means the same. Without --from, the command reads the folder’s checkout, as fluid sites branch current does. In a folder that is on a branch, the new branch starts from that branch, and the command says so. In a folder on main or on a git branch of your own, it starts from live. If the folder is on a branch that has since been deleted, the command stops and sends nothing. Pass --from to choose. The new branch is a copy of the source’s last published version:
  • Its files are the ones the source last published.
  • Its tables are the source’s tables, with no rows. The source’s rows are never copied.
  • Its git history is the source’s, up to the commit that version was built from. The new branch’s git branch starts there.
What you haven’t published isn’t in it. Edits in a folder that you didn’t publish to the source are left out, so publish the source first. Variables and secrets set only on the source aren’t copied. The new branch reads the Site’s variables that aren’t secret, like any branch. Set the others on the new branch. See Environment variables and secrets. The branch stays a branch of the Site. The branch list is flat, and a promote always goes to live. There is no promote into another branch. Behind live compares a branch with live only, never with the branch it started from. A branch made from a source that is behind live starts behind live. Update it before you promote. To start from another branch through the API, send source_branch with that branch’s slug in the body of Branch a site, or for a company site Branch a company site. Leave it out, or send null, to start from live. An empty string is refused. Site branches must be turned on, or source_branch is refused as an unknown field. Both the Member API and the company API take it. A branch that can’t be a source is refused with its own code, and nothing is made: A source_branch that names no branch you can open is answered 404. A malformed one is answered 422. A branch that another branch is being made from can’t be deleted until that branch is finished. A delete is refused with source_branch_in_use (409) while the new branch’s files, tables or git branch are still being copied from it. Wait, or delete the new branch first. Deleting the Site itself is never refused for it.

The branch’s git branch

With staging turned on, each branch gets its own git branch in the Site’s source repository. Its name is fluid/branches/ and the branch’s id, not the slug. Fluid makes it from the head of main shortly after the branch is made, or, for a branch made from another branch, at the commit that branch last published. It deletes the git branch when you delete the branch. If you publish right after you make a branch and the source isn’t ready yet, the command waits and asks again.

List, show and delete

list shows each branch, staging first, then the oldest. For each one it shows who made it, its address and whether it’s behind live: the Site has published since the branch was made or last updated. show and delete take the branch’s slug as an argument. delete asks first, and --yes skips the question. Deleting a branch deletes the branch’s own Site and its git branch. The live Site doesn’t change.

Publish to a branch

To work on a branch’s source, pull the branch into a folder of its own, or switch a folder you already have to it. fluid sites branch update needs a folder that is on the branch’s source, made either way.
fluid sites pull --branch <slug> clones the branch’s git branch into a new folder and binds the folder to the Site. fluid sites publish --branch <slug> saves the folder’s source to the branch’s git branch and publishes it to the branch only. The live Site doesn’t change, and nothing is saved to main. Open the branch’s address to check it. With --json, the result names the branch the publish went to in branch, and so do the refusals of a branch publish, such as one that needs a destructive migration confirmed. A publish to the live Site has no branch. A script can read where a publish went, which a plain fluid sites publish decides from the folder’s checkout. Source and branches says what a publish saves. An editor of a member’s Site can pull a branch the same way, while your company has site branches or staging turned on. The editor can’t pull the Site’s live source. A plain fluid sites pull is refused and lists the branches to pull. An editor’s publish to a branch saves the editor’s commit through Fluid.

Switch the folder between branches

One folder can follow the live Site and each of its branches. You don’t need a folder for each.
  • switch <branch> checks the branch out in the folder. main is the live Site. It commits your edits on the branch you leave, so nothing is lost, then checks out the other one and merges in what was saved to it since. A file changed on both sides keeps both versions between conflict markers, as fluid sites pull leaves them, and the command exits with status 1.
  • A switch never publishes. It doesn’t push, and it doesn’t change the live Site or a branch.
  • It refuses when the folder isn’t ready. That is the case while a merge is unfinished, while conflicts from an earlier pull or switch haven’t been published, while another git command is running in the folder, and when the folder is inside another git repository. Nothing changes.
  • It says what to do next. When package.json or a lockfile changed, it tells you to install the packages. When db/schema.json changed, it says fluid sites dev applies it to the branch’s own local database.
  • current says which branch the folder is on. It reads the folder and makes no request, unless a branch’s name has to be looked up. A folder on a git branch of your own, or on no branch, is reported as local, and it publishes to the live Site.
  • --json prints one line of JSON for each command, with progress on stderr, so a script can read it. A switch with conflicts exits with status 1.
A plain fluid sites publish follows the checkout. In a folder that is on a branch, it publishes to that branch, says so, and leaves the live Site alone. Naming another branch with --branch is refused, and so is a folder whose branch was deleted. Switch first. A folder on main or on a git branch of your own goes where --branch says, as before. To make a branch live, promote it. See Promote a branch to live. An editor can switch between a Site’s branches, and has no live source to switch to.

Each branch has its own local database

fluid sites dev gives each branch its own local database, .fluid/branches/<slug>/dev.sqlite in the folder. The live Site keeps .fluid/dev.sqlite. Switching branches never mixes the rows or the schema of one with another’s. fluid sites dev --reset-db deletes the database of the branch the folder is on. A folder you pulled onto a branch before branches had a database each has that branch’s rows in .fluid/dev.sqlite, and the next fluid sites dev moves them to the branch’s own. See Develop a Site locally.

The branch’s database

A branch of a Site with a database gets a database of its own. With site branches turned on, it starts with the tables, indexes and migrations of what it started from, live by default, and no rows. Its rows are test data you write by using the branch. Promoting never moves them to live. The branch’s database is made in the request that makes the branch. If that fails, the branch stays a draft and Fluid finishes the copy in the background. To start over, reset the branch’s database:
reset-database needs site branches turned on. The command asks first, and --yes skips the question. The branch’s own rows are lost. The Site itself doesn’t change. A branch needs a reset when its schema check says its database was copied before Fluid recorded its migrations. Fluid accepts the reset and finishes it in the background, within about 15 minutes. Until then, the branch’s database is unavailable, and a publish to the branch fails with copy_in_progress. Don’t run it again while it runs. A second reset starts over and erases the rows written since.

Copy live’s rows into a branch

To test with real data, add --copy-live-data. The reset then gives the branch live’s tables and live’s current rows, and replaces the rows the branch had.
Only a reset of an existing branch takes this option. By default, a branch you make has no rows.
Anyone with Can edit on the Site can open the branch and may see the copied rows. The command shows this warning before it asks, and --yes answers the question but not the warning. If the server sends no warning, the command sends nothing. Copy live’s rows only when the people who can edit the Site may see them.
  • Who may do it. The Site’s owner, or a signed-in company admin whose role has Update on Application Themes and View on Member Site Data. Run the command with --as admin as an admin. An editor, and a member who isn’t the owner, is refused with owner_only, and nothing changes.
  • How much. Live’s database may hold at most 100,000 rows and 256 MiB. A larger one is refused with live_data_too_large, and nothing changes. The command prints how many rows and bytes live holds against the limits. Reset the branch without --copy-live-data instead.
  • When. Fluid accepts the request and copies in the background, within about 15 minutes plus the copy time, which can be up to ten more minutes. The rows are live’s as they are when the copy runs. The branch’s database is unavailable until then, and a publish to the branch fails with copy_in_progress. Fluid starts one copy of live’s rows for each run of its background job, so another branch’s copy can wait for the next run.
  • A copy that can’t be made becomes a tables-only reset. Fluid tries twice. If live has grown past the limits by then, the copy runs too long or it fails again, the branch’s database is reset to live’s tables with no rows instead. fluid sites branch show and list print Live data wasn't copied and why.
  • Two kinds of reset can’t overlap. While a reset of one kind is waiting, asking for the other kind is refused with reset_mode_conflict. Asking for the same kind again changes nothing.
  • A promote never moves rows. A copy changes the branch’s rows only.
show and list print Database: copying live data… or resetting to live's tables, with no rows… while a reset waits. With --json, each branch carries database.reset, database.live_data_fallback and database.copy_live_data_confirmation. See Give a site’s branch a fresh copy of the live database for the request. Its body is copy_live_data: true, and it is on both the Member API and the company API.

Settings in a branch’s functions

A branch’s server functions get the Site’s variables that aren’t secret, plus the branch’s own. A value set on the branch wins over the Site’s. A secret of the Site never reaches a branch’s functions. Set it on the branch if you need it there. See Environment variables and secrets.

Update a branch from live

Update a branch when the Site has published since you made it. The branch is behind live, and a promote is refused until the branch holds what is live.
Run it in a folder that is on the branch, one you made with fluid sites pull --branch or switched with fluid sites branch switch. A folder on the live Site’s source, or on any other git branch, is refused. With more than one branch, --slug is required. The command commits your local edits, then merges live’s source into the folder. Your edits stay. If it merges cleanly, it puts the migrations in db/schema.json in order (see the merge rule), commits that, and checks the schema. Then publish the branch, so its published version holds live:
If a file changed on both sides, the command prints a CONFLICT <path> line for each one and exits with status 1. Each file keeps both versions between <<<<<<< and >>>>>>> markers. Resolve them, then publish the branch. A file one side deleted has no markers: keep it with git add <file>, or remove it with git rm <file>. Nothing is published until you do. If the folder already holds live, the command says so and runs the schema check.

The migration merge rule

Each database skips a migration it has already run. So when two branches add migrations, the merged list has to run in one order on every database. The rule is:
  1. Live’s migrations come first, in live’s order.
  2. The branch’s own migrations come next, in the branch’s order.
  3. Each migration appears once.
fluid sites branch update applies the rule for you after a clean merge. If Git conflicts in db/schema.json, apply it yourself. For example, live holds 2026-11-20-rsvp-party-size. Your branch holiday-homepage adds 2026-12-04-events-headline. Meanwhile another branch is promoted with 2026-12-02-events-capacity-seats, so live now holds that migration and the first one. After an update, the branch’s migrations list reads:
db/schema.json
When you publish the branch, its database runs 2026-12-02-events-capacity-seats and skips the two it ran already. When you promote, live runs 2026-12-04-events-headline and skips the other two. One id has one set of steps. Say two branches each add a migration with the same id and different steps, and one is promoted. When the other updates, the file keeps live’s version and the command warns you, and the schema check refuses the id with migration_id_collision. Give the branch’s migration a new id that carries the branch name, such as holiday-homepage-rename-title, and put its steps back under that id. The same id with the same steps is never a collision.

The schema check

After each update, the command asks Fluid whether the merged db/schema.json plans on the branch’s database and on the live Site’s. It never changes either database. If the schema doesn’t plan, the command exits with a non-zero status and names the database and the planner’s message. Fix the order or the steps, commit, and run the command again. A migration that renames or drops what another changed has to come after it. The check also refuses:

Promote a branch to live

Promoting makes the branch’s published version the Site’s live version. It asks first. --yes skips the question. It does these in order:
  1. It checks that the branch holds what is live now. If not, nothing changes. Update the branch, publish it, and promote again.
  2. With site branches turned on, it checks that the branch’s schema plans on the live database, before anything moves.
  3. It fast-forwards main in the Site’s repository to the branch’s commit. It never forces main.
  4. It publishes the branch’s version as the Site’s live version.
The command then prints the new live version and the command that undoes the promote. A promote carries everything the branch published to live. Rows never move from a branch to live. If the branch changed the schema, live’s database gets those changes the way a publish applies them. See Change the schema. A promote is refused, with nothing changed, when:

Promote over a live version with no saved source

A promote checks that the branch holds everything live has, by comparing the source commit of each. A live version that has no saved source has no commit to compare. A version has none when it was published with --no-source, by a deploy through the MCP server, or before Fluid saved each version’s source. The promote is refused with live_unsourced (409), and nothing changes. You have two ways on. You can save live’s source and bring live into the branch, or you can promote anyway. Promote anyway. Promoting anyway replaces live with the branch without checking it. Changes made straight to live that the branch lacks are not found, and they are gone from live after the promote. Do it only when you know that nothing on live is missing from the branch. The refusal says when this is possible. Its details.confirmable is true, and details.live_bundle_id names the live version Fluid saw. It is not possible when the Site serves no version, and confirmable is then absent. Send the same promote again with confirm_unsourced_live set to true and live_bundle_id set to that id. The promote goes ahead only while that version is still live. If another version went live meanwhile, it is refused again with that version’s id, so you confirm what is live now. With the CLI, the refusal prints the command to run. Add --confirm-unsourced-live with the live version’s id:
Without --yes, the command asks first, and the question says live’s version is replaced without a check. The confirmation skips one check, the comparison with the live source. Every other check still applies:
  • The branch’s own published version must record a source commit (staging_unsourced).
  • main must not have commits the branch lacks (source_changed).
  • The branch’s schema must plan on the live database, and a destructive migration still needs its own --confirm. A promote that has both needs both confirmations.
  • The publish still expects the live version that was checked, so a publish that landed in between is refused.
An undo works as for any promote. The version it replaced is the one without a source, and fluid sites rollback makes it live again. See Undo a promote. Save live’s source first. To fix it once, so later promotes are checked, publish the live Site from a folder that holds its source, then bring live into the branch. A plain fluid sites publish follows the folder’s checkout, so the folder must be on main to publish live. The refusal prints these steps for the folder you are in:
The live publish sends the folder’s main as it is. If live was last changed by a deploy through the MCP server, check the live preview first, so nothing is lost. The MCP server’s site_branch_promote can’t promote past this refusal. Use the CLI, Mist or the API. The company route and the Member API both take the confirmation. See Promote a site’s branch.

Confirm a destructive migration

A migration that drops or renames a table or column, or changes a type, changes live’s database in a way you can’t undo. The promote stops and lists each migration’s id. Run it again with --confirm for each id and --bundle for the branch’s version it named:
If the branch published another version since the refusal, the promote is refused, because you never saw that version’s migrations. Promote again without --confirm to see them. See Make a destructive change. If a promote moves main and then stops before the Site goes live, the command says so. Run the same promote again to finish it.

Undo a promote

A promote prints an undo command:
The first id is the version the promote replaced. --if-current names the version the promote made. The undo goes ahead only while that version is still live. With Sites plugin 0.1.532 or later, if something else went live since, the command exits with a non-zero status and changes nothing:
Fluid checks again when it moves live, and refuses with live_changed. Publish the change you want as a new version instead. Picking a version from the deployment list doesn’t check what is live. An undo makes the replaced version live again. With site branches turned on, it can also put the Site’s database back, as the next section says. Without them, it never changes the database.

Undo the database change

A promote that changed the live database can be undone, in the database too, while your company has site branches turned on. Undo reverses these changes of the promote:
  • a table or column that was renamed, which is renamed back;
  • a column that was made required, which is optional again;
  • a unique set that was added, which is removed.
It keeps what the promote added: a table, an optional column or an index. The earlier code never names them. A table or column that the promote dropped, or a column whose type it changed, comes back from data Fluid saved when the promote ran. While site branches are on, a publish to the live Site saves what its drops and type changes remove, in copies that Fluid keeps while the version is among the Site’s 25 newest. It saves nothing for a company without site branches, and nothing for a branch’s own database, which is never rolled back. A dropped column comes back optional, a dropped table with its columns and indexes, and a retyped column in its earlier type. The undo goes ahead only when all of these hold. If one doesn’t, it is refused with schema_changed and a details.reason, and nothing changes:
  • The promote is the latest change to the live database, and it replaced the version you go back to.
  • The database still holds what the promote left. A reset or an archive of the database changes that.
  • Fluid kept the promote’s steps, and every drop and retype in it has saved data.
  • The saved data to put back is at most 1,000,000 rows and 512 MiB. A bigger restore is refused with the reason restore_too_big.
  • The promote didn’t add a required column, because the earlier code’s inserts would be refused. The refusal names the step.

Confirm what the undo changes

An undo that has to change the database stops first and changes nothing. The API answers 422 with schema_rollback_unconfirmed and three details:
  • schema_apply_id, the id that confirms it;
  • steps, what going back changes, newest change first;
  • data_lost, which is none or says what the undo loses.
Data is lost in two ways. Rows added since the promote get no value in a column that was restored. A retyped column gives the rows that existed their saved values back, so changes made to them since are lost, and it converts the other values where it can. Values that can’t be converted are left empty, and are counted by column and never shown. To confirm, send the same request again with confirm_schema_rollback set to the schema_apply_id. Fluid puts the database back in one transaction, then moves the Site to the version. If a value was written after you looked, the id no longer matches. The request answers schema_rollback_unconfirmed again with a new id, and changes nothing. With the CLI, the undo you ran asks. At a terminal, it lists the steps and what is lost, then asks Roll back the database too?
With --yes, with --json or with no terminal, the command changes nothing and prints the command that confirms. --yes doesn’t confirm the database change. Run the printed command, which carries --confirm-schema and the id, and which needs --if-current:
If the database change runs out of time, the command and the API answer 409 with rollback_incomplete. The change may have been made, and the Site still serves the version it served. Send the same request again with the same id. Fluid asks the database what it holds and finishes. While an undo is changing the database, a publish to the Site answers 409 with rollback_pending, and nothing is published. Send the publish again once the undo is done. In Mist, an undo that needs the database change shows the steps and what is lost, with Roll back the database. See Undo a promote. An undo that these rules don’t cover is refused with schema_changed, and the Site and its database stay as they were. A promote that only added tables, optional columns or indexes undoes with no database change. See Deployments and rollback.

Keep the branch’s changes

After a valid undo, Fluid adds one commit to main whose files are the restored version’s source. So the next update or promote doesn’t bring the undone change back. Fluid never forces main, and it leaves main alone when:
  • someone pushed to main after the promote;
  • the restored version, or the one it replaced, records no source commit;
  • GitHub didn’t answer or refused. The Site itself is rolled back, and Fluid tries again if GitHub didn’t answer;
  • the Site went live with another version first.
The command prints one line when it didn’t restore main. The branch you promoted still has its changes. To keep them instead of merging the restore commit into them, update with --keep-branch:
It records the restore commit as merged and keeps the branch’s files. It’s refused unless main’s head is a restore commit whose parent the folder holds. Publish the branch afterwards, as after any update, and fix forward.

Which Sites plugin you need

Through the API

Each command calls the Sites API. See List a site’s branches, Promote a site’s branch, Check a schema for a site’s branch and Give a site’s branch a fresh copy of the live database An undo is Make an earlier bundle current (roll back), with expected_current_bundle_id and, to confirm a database change, confirm_schema_rollback.