# Branch workflow

> Feature branches get an isolated shadow project, so unfinished strings never reach the shared project until the branch is merged and promoted.

Translation files cause merge conflicts because every branch edits the same few files.
Rodarion solves that by following your git branches.

## How it works

- On the **default branch**, the CLI syncs with the **central project**.
- On **any other branch**, the CLI detects the branch name and syncs with a **shadow
  project**: a copy of the central project that belongs to that branch only. New keys,
  changed texts and machine translations stay there.
- When the branch is **merged**, `rodarion promote --branch <name>` folds the shadow into the
  central project, machine-translates what is still missing and downloads the result.
- When a branch is **abandoned**, `rodarion discard` deletes its shadow.

Nobody has to remember the promote step: `rodarion ci` writes a workflow that runs it on
every merge. See [CI](/docs/ci).

## Who wins on a conflict

On a feature branch, **local wins for keys that are new on that branch**. If you write or
correct a translation for such a key in your local files, `rodarion up` pushes it into the
shadow and machine translation leaves it alone.

Two things are never overwritten from a branch:

- keys that already exist in the central project, so a stale local file can never replace a
  shared translation;
- any translation marked **approved**.

Change those in the app or with `rodarion translate`.

## Trying it without touching your default branch

Set `RODARION_CENTRAL_BRANCH=<branch>` in `.env` to make any branch act as the central one.
That is how an agent rehearses the full branch, merge and promote cycle in a trial without a
commit ever reaching your real default branch.