Skip to main content
Branches are in beta.
You manage branches with bijection branch or from the Branch page of the Bijection console. This page walks through a branch’s life from the command line.

Choosing the parent

bijection branch acts on the deployment you select, the same way other commands do: your dev deployment by default, --prod for production, or --deployment <deployment> for another one. That deployment is the branch’s parent. Every lifecycle command, including those for an existing branch, runs against the parent. Branch commands refuse a branch URL as the selected deployment. A branch’s own admin key only works on the branch, and the parent always refuses it.

Creating a branch

Output
The branch forks live at its current revision, shown after Fork of:. That revision is the branch’s basis, and it never moves.
  • A branch key is 1 to 40 lowercase letters, digits or hyphens, starting with a letter or digit.
  • Pass --empty to start from an empty deployment instead of live data.
  • Pass --ttl-hours <n> to choose when the branch expires. The default is 3 days, and the longest is 30 days (720 hours).
  • Running create again with the same key, parent and owner returns the existing branch. It does not create a new one with a later basis.

Opening a branch

A branch has its own URL, https://<your deployment>/branch/<key>/<token>. Use it wherever you would use a deployment URL: in a client, in the console, or with the CLI.
A branch link is personal. It admits only the person it was issued to, and it is valid for 12 hours, never past the branch’s expiry. Every request checks it again. Print a fresh link at any time with bijection branch status <key>.

Deploying code to a branch

To deploy to a branch, you need its admin key. Only administrators receive one.
Output
Then deploy as you would to any deployment:
The new code runs only on the branch. To change live, deploy to live the ordinary way. Applying a branch never deploys code.

Running functions and operations on a branch

bijection run works against the branch URL too. Operations run as a user, so pass the user’s identity with --identity:
Remember which identity you used. Applying and rebasing replay the operations invoked under one identity at a time.

Open and closed branches

A branch loads the first time it receives a request. A branch with no requests and no connected clients for 10 minutes is closed. Its data is kept, and the next request loads it again. A closed branch runs nothing. Its scheduled functions run late, when it next opens. A cron job whose runs were due while the branch was closed runs once, and the other missed runs are skipped.

Sharing a branch

A branch is visible only to its owner and to administrators until you share it. Share it with users by their token identifier (issuer|subject, see auth in functions), not a JWT:
A user you share with opens the branch with their own sign-in and gets their own link. Sharing admits them to the branch, never to more data: their own permissions still govern every read.
Unsharing takes effect at once. Every open connection to the branch closes, and users who are still admitted reconnect. Only the branch’s owner or an administrator can share, unshare, extend, rebase or discard a branch.

Comparing with live

compare runs one query on the branch and on live at the branch’s basis, so any difference is the branch’s doing, not live moving on.
Output
When both results are arrays of documents, compare matches them by _id and lists the documents added, removed and changed, field by field. Any other result is compared as one value and reported as identical or different. The query runs as you. Pass --identity to run it as a user, and --json for the full results.

Listing and inspecting branches

list shows every branch you can open. status shows one branch, how far you have applied it to live, and a fresh link.

Extending a branch

extend sets the expiry to the given number of hours from now, up to 30 days. The basis does not move. A branch whose expiry has passed can no longer be extended. A branch that expires stops serving requests, and the deployment discards it within about a minute.

Discarding a branch

Discarding deletes everything committed on the branch, and its links stop working. What you already applied to live stays applied.
An open branch of live makes your deployment keep its history since the branch’s basis. Discard branches you’re done with.