branch
A branch is a separate development line of the program's code, on which changes can be made while the functioning main version remains untouched.
In plain terms
Imagine you want to rewrite a shared family recipe book but do not want to scribble on the original. You experiment on separate sheets and only transfer the changes to the book if the cake is truly better. A branch is such an isolated workspace for a program's code. You do not need to copy the entire book: the system only records what has changed.
This way, developers can work on multiple things simultaneously: on one branch someone fixes a bug, on another a new feature is prepared, while the main branch – from which the user-facing version is built – remains stable. If an experiment fails, the branch is simply discarded, and the main branch is not harmed.
In the era of coding agents, the branch has become even more important. The agent works on its own branch, so its work remains separate until a human reviews and approves it. Multiple agents can work in parallel, each on its own branch, without overwriting each other's work.
How it works
- The developer or agent opens a new branch from the current state of the code and names it, for example, "payment-bug-fix".
- Changes made on a branch are recorded in save points (commits). These are visible only on this branch; the main branch remains unchanged.
- Once the work is done, a pull request (called a merge request on GitLab) is opened. Others can review what changed, and automated tests can run on it.
- After approval, the branch is merged into the main branch. If someone else modified the same lines in the meantime, a conflict may arise. This must be resolved by a person or an agent before the merge is completed.
- The merged branch is usually deleted, and a new branch opens for the next task.
An everyday example
You ask a coding agent to fix the incorrect total on your webshop's cart page. The agent does not touch the live code but opens a separate branch, makes the fix there, and then shows you what changed. Your customers will only see the new version if you approve it.
Who is affected
A common misconception
Limits and risks
- The longer a branch lives separately from the main branch, the greater the chance that merging will cause difficult-to-resolve conflicts.
- A branch does not check quality on its own: if flawed code from an agent or human is merged without review, the error goes live unchanged.
- A branch only separates the code, not the database, passwords, or external services, so an agent running on a branch can still cause damage to the live system.
- Many parallel branches, especially with multiple agents working simultaneously, can easily become opaque without a naming and cleanup system.
Similar, but not the same
- fork – A fork is an independent copy of the entire repository, typically in another account. A branch, however, is a parallel workflow within the same repository.
- commit – A commit is a single save point for changes. A branch is a forward-moving pointer that always points to the latest commit of the branch, and through it the entire history of the branch is accessible.
- worktree – A worktree is a working directory on the machine where the files of a branch actually appear. A repository can have multiple worktrees, allowing work on multiple branches simultaneously. This is often utilized by agents running in parallel.
Related concepts
A brief history
The idea of branches appeared in early version control systems, but their use was cumbersome for a long time, especially merging. Git, created by Linus Torvalds in 2005, made opening and merging branches a fast, everyday operation. GitHub, launched in 2008, then spread the workflow organized around pull requests.
Where things stand
A branch has been a standard tool in software development for decades. By the end of 2026 it has also become the usual framework for coding agents' work: the agent typically works on its own branch, and the result is merged into the main branch after human review.
In the news
- Portfolio: workers at risk from AI are cutting off the branch they sit onOct 14, 2026 · Work & HR
- Databricks Lakebase proposes branching databases for coding agentsOct 8, 2026 · Code
- AI agents already work as colleagues; part of Google's enterprise AI work is tied to BudapestSep 7, 2026 · Code
Also known as
branch · branch · development branch · code branch · Git branch · feature branch · branching · branching
Sources
This entry was machine-edited and has undergone machine expert review; the “In the news” section updates automatically from Agent Age stories.