FolioFolioDocs

Merging and review

Collaboration in parallel is messy. When multiple teammates and agent sessions work on the same project at the same time, different sessions will often end up modifying the same file on separate branches.

Folio handles this in two ways:

  1. Modal review and merge (available today): Review a branch's changes side by side, see where main moved ahead, and pick which version becomes current on main in one click.
  2. Agent consolidation across versions (in development): Let a coding agent (such as Claude Code, Codex, or another agent) step through each competing version of a file and merge the work together into one reconciled version.

Reviewing and merging a branch

For most workstreams, you review and merge directly from the Merge into main… dialog on the branch bar. When two branches touch the same file, you inspect the flagged file and choose which version becomes current on main.

Codex and Claude Code each start a branch from main at the same time, and each saves its own card.png. Codex's branch is merged first, so main has its card.png, v2. When Ana reviews the merge of Claude Code's branch, the dialog lists every file with its version on the branch and on main, and flags card.png, which main changed after the branch startedCodex and Claude Code each start a branch from main at the same time, and each saves its own card.png. Codex's branch is merged first, so main has its card.png, v2. When Ana reviews the merge of Claude Code's branch, the dialog lists every file with its version on the branch and on main, and flags card.png, which main changed after the branch started
  • Whole-branch merge: Merging brings the entire branch into main in one step. There are no per-file checkboxes in the merge dialog. If you only want a single file from a branch, switch to main, open that file's history, and make that version current instead (see Versions on branches).
  • Side-by-side preview: Files are grouped by folder, showing each file's version On branch next to On main, with filters for All, Changed, and Needs a look.
  • Needs a look flags: If main changed a file after your branch started, Folio flags it with a notice: "Main moved to v2 after this branch started. Merging makes v3 current; v2 stays in history." You decide whether to proceed with the branch's version, knowing that main's version stays safe in history.
  • Stale-preview guard: If someone changes one of the affected files on main after you opened the preview dialog, Folio stops the merge and asks you to refresh the preview before applying it.
  • Runs on the server: Large merges (up to 2,000 changes per merge) run in batches on the server with a progress bar. Closing your browser tab does not stop a merge that is already running.

Consolidating parallel versions with an agent (in development)

Picking one version in the merge dialog works when one branch should win. The harder case is when two or more parallel sessions each made useful changes to the same file and you want to combine all of their work.

Because Folio keeps every version from every branch intact and addressable, we are exposing these version-browsing and merging semantics directly to coding agents (Claude Code, Codex, and other agents). Instead of forcing you to resolve conflicts by hand, an agent can cursor through each competing version of a file, inspect what changed in each branch, and produce a new consolidated version that combines the work.

Codex and Claude Code each save their own version of card.png on a branch, v2 and v3. A Claude Code session on its own branch, consolidate, reads the two versions one after the other and saves one with the work of both, v4. That branch then comes into main, and main has card.png v4. Marked as in developmentCodex and Claude Code each save their own version of card.png on a branch, v2 and v3. A Claude Code session on its own branch, consolidate, reads the two versions one after the other and saves one with the work of both, v4. That branch then comes into main, and main has card.png v4. Marked as in development

What a merge does to your files

Merging in Folio is designed to be non-destructive:

  • New and edited files: New files are placed on main (creating any missing parent folders automatically). Edited files promote the branch's version to current on main, while keeping main's earlier version in history. Files whose content is already identical on main are skipped.
  • Deletions do not travel to main: Deleting a file on a branch removes it only on that branch. Merging never deletes files on main.
  • Moves and renames become copies on main: Because a merge never deletes anything on main, moving or renaming a file on a branch places the file at its new path on main while leaving the original path on main in place.
  • Name collisions are preserved, not overwritten: If both main and your branch independently created different files at the same path, Folio layers your branch's file as the next version of main's file so both versions stay in history. If a branch adds a file where main now has a folder (or a folder where main now has a file), Folio places the branch's item beside it (for example, name (2).ext).

Undoing a merge

After a merge completes, Undo on the branch bar reverts it in one step:

  • Files that the merge updated on main switch back to the version that was current right before the merge.
  • Brand-new files that the merge placed on main are removed from main (their versions remain in history).
  • Later edits on main are protected: If someone edited a file on main after your merge, Undo leaves that file untouched so newer work on main is never lost.

Like merging itself, Undo runs on the server and never deletes any file versions.

After merging and permissions

  • Branches stay open: Merging does not close a branch, and branches cannot be deleted today. You can continue working on the branch and merge again later; files that are already up to date on main are skipped automatically.
  • Who can merge: Today, any workspace member can review and merge a branch into main. Role-based merge restrictions and required reviewer approvals are not enforced yet.