Skip to main content
Git worktrees let you check out multiple branches of the same repository into separate directories at the same time. Codeg integrates worktree creation directly into the workspace so you can spin up parallel agent sessions — each working in isolation on its own branch — without any manual git worktree commands.

Why worktrees

Running two agents on the same working tree creates conflicts: one agent’s file edits can interfere with another’s. Worktrees solve this by giving each agent its own directory and branch:
  • Isolate experimental or risky changes from your main branch
  • Run agents on different features simultaneously and compare results
  • Keep a clean base branch while an agent works in a worktree

Creating a worktree

1

Open your repository in Codeg

Open the root of a git repository as a folder in Codeg. The version control panel becomes available in the sidebar.
2

Go to the version control panel

Click the Version Control icon in the sidebar to open the git panel.
3

Create a new worktree

Click New Worktree, enter a branch name, and optionally set a parent branch to base the new branch on. Codeg runs git worktree add in the background and creates the new directory alongside your repository.
4

Open the worktree folder

The worktree appears as a separate folder entry in the sidebar. Click it to open the worktree workspace, then connect an agent and start a session there.

Parent branch

When you create a worktree, you can set a parent branch — the branch the worktree’s new branch is based on and where you intend to merge back. Codeg records the parent branch so the merge workflow knows the target. You can also set or update the parent branch for any open folder from the version control panel at any time.

Merging back

Once an agent completes its work in a worktree, use Codeg’s built-in merge tools to integrate the changes:
1

Open the merge window

From the worktree folder, open Version Control > Merge. The merge window shows the diff between the worktree branch and the parent branch.
2

Resolve any conflicts

If there are conflicts, Codeg’s conflict resolution view shows each conflicting file with the local, remote, and base versions side by side. Accept one side or edit the merged result directly.
3

Complete the merge or rebase

Click Merge or Rebase to finish. Codeg runs the git operation, then marks it complete. You can abort or continue an in-progress merge or rebase from the same panel.

Built-in git operations

The version control panel exposes a full set of git operations for each open folder or worktree:

Commits

Stage files, write a commit message, and commit — with support for amending and signing.

Branches

Create, checkout, rename, and delete local branches. Delete remote branches when you’re done.

Push and pull

Push to remotes, pull with merge or rebase, fetch individual remotes, and view ahead/behind counts.

Stash

Push, pop, apply, show, and drop stash entries without leaving the workspace.

Merge and rebase

Merge branches, rebase, abort or continue in-progress operations, and resolve conflicts file by file.

Diff and log

View file diffs, compare branches, inspect the commit log, and show individual commits.
Worktrees are standard git worktrees. You can manage them with regular git worktree commands in the terminal if you prefer — Codeg will pick up the changes on the next folder refresh.