Create a branch
Start a new branch from the default branch (typically main or master). When you query the new branch, Infrahub combines two things: the default branch's data as of the moment you created the branch, a time it records as branched_from, and every change you make on the branch afterwards. Creating a new branch is almost instantaneous because Infrahub uses copy-on-write semantics: no data is duplicated, and Infrahub stores only the branched_from timestamp and the changes made on the branch.
When you create a branch​
When creating a branch, you specify:
- A name that clearly identifies the branch's purpose, for example
feature-network-redesignorfix-datacenter-connectivity - An optional description to help team members understand its scope
- Whether the branch should synchronize with Git repositories (
sync_with_git: true) — see Branch isolation modes for the differences between full branches and data-only branches
Branch creation methods​
Branch creation can be initiated through the Infrahub user interface, GraphQL API, the Python SDK, or the infrahubctl CLI. The branch is created immediately and you can begin making changes once it exists.
Related​
- Branches — concepts, hierarchy, isolation modes
- Merge a branch — when work is complete
- Rebase a branch — incorporate upstream changes
- Selective branch synchronization — control which Git branches sync to Infrahub