poly branch requires a subcommand:
Examples:
poly branch list
List all branches in the project.
Examples:
--json output shape:
--archived, the shape is { "archived_branches": [...] } instead.
poly branch current
Show the current branch, and its parent branch if it isn’t main.
Examples:
--json output shape:
null.
poly branch create
Create a new branch, sourced from your current branch by default. In the standard deployment mode, a new branch can only be sourced from main — if you aren’t currently on main, switch there first or pass --from main explicitly.
Examples:
When
--env live or --env pre-release is specified:
- the version of the deployed environment is pulled into your local workspace
- the new branch is created
- that version is immediately pushed to the new branch, leaving a clean slate for hotfix changes
- if there are local changes, the command fails unless
--forceis also passed
--json output shape:
poly branch switch
Switch to a different branch. Omit branch_name for an interactive picker.
Examples:
--keep-files switches without touching your files, so the next poly push sends your working copy to the target branch. --create creates the branch if it doesn’t exist, sourced the same way as poly branch create: from your current branch, or from the branch given with --from.
Together, they keep a project in a git repo on the Agent Studio branch matching the git branch: after git switch, the last example tracks the branch of the same name, creating it from main if needed, without overwriting what git checked out.
--json output shape:
"created" is true when --create made a new branch.
With --output-json-projection, a "projection" key containing the full project projection is added.
poly branch rename
Rename the current branch. main cannot be renamed.
Examples:
--json output shape:
poly branch delete
Interactively select and delete one or more branches. main cannot be deleted.
- Run without arguments to open an interactive checkbox prompt for selecting branches to delete.
- Pass a branch name directly to skip the interactive prompt and delete that branch after confirmation.
--json output shape — single branch:
"switched_to" is only present when the deleted branch was your current branch. Multi-select delete (no branch_name) reports a count instead:
poly branch restore
Restore a soft-deleted branch from the archive. Archived branch names aren’t unique, so restoring by ID is required in non-interactive use — find IDs with poly branch list --archived.
Examples:
--json output shape:
poly branch merge
Merge the current branch into its parent (main, unless you branched from another branch). A message is required when merging into main.
Examples:
main deploys to live while an experiment is running, it changes the live version the experiment compares against. The confirmation prompt names the experiment, and answering yes acknowledges it. With --force or --json, pass --acknowledge-experiment instead, or the merge is blocked.
--json output shape:
"conflicts" and/or "errors" arrays are added and the process exits non-zero.
Conflicts
If the merge has conflicts, the command prints a conflict table and exits non-zero. The table shows, per conflicting field:- Path — the resource and field that conflicts (for example
topics > Booking > content) - Base / Ours / Theirs — the original value and the two competing values
- Auto-merged value — what the ADK would produce by line-merging both sides
- Auto-mergeable — whether the auto-merged value contains any unresolved markers
--interactive and accept the suggestions, or pre-populate --resolutions with the auto-merge values.
--interactive / -i
Interactive mode walks through each conflict and asks how to resolve it. For every conflict you can:
- accept the auto-merge (when available)
- pick the parent branch (
ours):main, unless you branched from another branch - pick the branch (
theirs) - pick
base(revert to the original value) - open the value in
$EDITOR/$VISUALfor free-form editing
--resolutions <source>
Supply pre-defined resolutions non-interactively. The source can be a JSON file path, a literal JSON string, or - to read from stdin. Combine with --interactive to seed a session — pre-defined choices apply automatically and you’re only prompted for the conflicts they don’t cover.
Resolution file format — a JSON array of objects:
Run
poly branch merge once to surface conflicts, then write a resolutions file addressing each path row.
Merging through the Agent Studio web UI
Switching to the branch and clicking Merge in the Agent Studio UI hits the same platform endpoint aspoly branch merge — the result is identical either way.
poly branch sync
Bring the latest changes from the current branch’s parent (main, unless you branched from another branch) into the branch, without merging the branch back.
Examples:
--json output shape:
"conflicts" and/or "errors" arrays are added and the process exits non-zero.
If the parent and the branch changed the same fields, the command prints the conflict table and exits non-zero. Resolve the conflicts the same way as for poly branch merge: "ours" keeps the parent’s value and "theirs" keeps the branch’s.
poly branch diff
Show changes made on a branch since it was created — its own local-vs-remote analogue is poly diff.
Examples:
--json output shape:
poly branch review
Create a GitHub Gist of the changes on a branch since it was created — the branch-scoped analogue of poly review create.
Examples:
--json output shape:
poly branch status
Show a branch’s status relative to its fork point — parent branch, who created it, whether it’s diverged, and its changed files. The branch-scoped analogue of poly status.
Examples:
--json output shape:
poly branch history
Show the branches that has been merged into the current branch. Long listings are automatically paged through the system pager when stdout is a TTY; output piped to a file or another command is never paged.
Examples:
--json output shape:
Related pages
- Working locally — where branching fits in the edit → push → merge loop
- Branches, push, and pull — the merge conflict model and team habits around branching

