Skip to main content

Branch awareness

Every schema element β€” nodes, attributes, and relationships β€” can be configured to control how changes to its data behave across branches.

By default, user defined schema elements are branch-aware: changes are local to the branch and do not affect other branches, the same way Git works.

An element can also be configured as:

  • branch agnostic: changes are immediately propagated to all branches.
  • branch local: changes stay local to the branch and are excluded from Diff and Merge operations.

Summary​

Branch SupportDescriptionDiffMergeRebase
AwareAll changes will be local to the branch and can be merged back into the main branch.YesYesYes
AgnosticAll changes will automatically be available in all branchesNoNoNo
LocalAll changes will be local to the branch and will not be merged to other branches.NoNoYes

Branch agnostic​

In the frontend, the API, or the GraphQL endpoint branch-agnostic objects can be modified on any branchβ€”no restrictions apply.

To configure a model as branch-agnostic you need to set the option branch to agnostic in the schema

nodes:
- name: Fruit
namespace: Example
branch: agnostic
attributes:
- kind: Text
name: name
branch: agnostic

Attributes and relationships​

Attributes and relationships can be configured as branch-aware, branch-agnostic, or branch-local too, independently of the configuration of the model itself using the parameter branch.

nodes:
- name: Fruit
namespace: Example
branch: agnostic
attributes:
- kind: Text
name: name
branch: aware

By default, if a specific value is not defined:

  • attributes will inherit the configuration of their parent model.
  • relationships will become:
    • branch-agnostic only if both models on each end of the relationship are branch-agnostic. If either model is branch-aware the relationship will be set as branch-aware.
    • branch-local if either model, on each end of the relationship, is branch-local.

Restrictions​

The branch property cannot be updated on a Node, Generic, Attribute, or Relationship after the schema is first loaded. Plan your branch support strategy before the initial schema load.

  • Schema migration β€” Restrictions on properties that can be changed after initial load
  • Branches β€” How branching works in Infrahub