Your Unreal project takes ten minutes to build. You finally reach a stable point on a feature branch, the Editor is warm, and then a teammate asks for an urgent fix on the release branch. You open source control, switch branches, and watch the recompile spinner eat into your afternoon. Git worktrees for game dev are the most direct way to stop paying this tax: each branch gets its own folder, its own Editor process, and its own build artifacts, so switching branches never forces Unreal to rebuild what another branch already compiled.
The Real Cost of Switching Branches in Unreal
Git doesn’t know about Unreal’s build process. When you run a checkout, it rewrites the working tree to match another commit, updating file timestamps, deleting stale files, and restoring others. Unreal’s build tool sees those changes and treats every modified header, every changed .uasset, and every deleted intermediate file as a signal that work needs to be done.
This is why a simple branch switch can produce a full recompile:
- UnrealBuildTool graphs the module dependencies and sees new timestamps on public headers, triggering a cascade of module recompiles.
- Shader compile jobs queue up for materials affected by the branch change.
- The asset registry rescans the Content folder to reconcile what Git just changed underneath it.
- Hot-reload tries to patch loaded editor classes, and often fails, forcing an editor restart and a fresh load of every asset.
None of that is optional; it is the engine doing its job consistently. The problem is that Git forces that consistency check even when you are returning to a branch you already compiled and ran minutes earlier.
What Git Worktrees Actually Give You
A worktree is a second working directory connected to the same repository. The repository history, branches, and objects live in the original .git directory, while each worktree holds one branch plus its own index and working files. You can create one per branch with:
git worktree add ../MyGame-Hotfix release/2.0 -b hotfix/release-blocker
That one command produces a folder that is a complete Unreal project: same .uproject, same Content, same Source — backed by the release branch, not your feature branch. From Unreal’s point of view, nothing is ever “switched.” The release worktree and the feature worktree are separate filesystems. Opening one doesn’t touch the state of the other.
When you return to the feature branch, the Editor opens the feature worktree folder, finds the same binaries it compiled earlier, skips the recompile, and lets you keep going. Build artifacts stay valid because the underlying source files were never mutated by another branch’s checkout.
Designing a Worktree Layout for Unreal Projects
Most Unreal teams settle into a straightforward layout. The main repository folder holds the long-lived branches, and worktrees are added as sibling folders:
MyGame/
.git/
develop/ # main worktree on "develop"
feature-vehicle-combat/ # worktree for a feature branch
release-2.0/ # worktree for the current release branch
scratch/ # throwaway worktree for experiments
For the scratch worktree, you can use:
git worktree add -b test/lighting-only ../MyGame-scratch develop
git worktree remove ../MyGame-scratch
Once a worktree is created, you don’t need to keep a terminal window alive. The worktree persists on disk and in Git metadata. Opening the .uproject in that folder is all you need to work on that branch — no switch involved.
Keep worktrees that are actively being edited open as separate Editor instances. Unreal supports multiple Editor instances as long as each points to a different project directory. On modern machines, that is the normal way to run a hotfix-and-feature workflow in 2026.
The Hidden Hero: A Shared Derived Data Cache
On a single machine, Unreal’s Derived Data Cache is shared by default. The engine writes DDC entries to a user-wide folder outside your project, so a texture processed in your feature worktree is instantly available to your release worktree. If you have configured a project-local DDC or a synced DDC folder, make sure all worktrees point to the same path.
[DerivedDataCache]
Shared Data Cache Path = \\studio-nas\UnrealDDC
For teams, a network or cloud-backed DDC is common, and every worktree naturally benefits from it. What you should not do is set a per-project DDC path inside Saved/DerivedDataCache and expect zero rebuilds — that creates a separate cache per worktree, and you pay the asset processing cost again. Keep one DDC across all worktrees and you skip most texture, shader, and sequel-related work before it starts.
A Step-by-Step Hotfix Workflow
Here’s how the whole thing works the next time a release blocker interrupts your feature work.
- Create the hotfix worktree. From the repository root, run
git worktree add ../MyGame-ReleaseFix release/2.0 -b hotfix/release-blocker. - Open the second Editor instance. Launch the
.uprojectin that new folder. The first build in a fresh worktree takes time, but it is a one-time cost that doesn’t affect your feature worktree. - Fix the bug. Commit in the hotfix worktree, push the branch, and let the team verify it as they normally would.
- Return to the feature worktree. Your original Editor has stayed open the whole time. No recompile, no asset rescan, no lost layout. You simply resume where you left off.
The entire switch cost is a couple of minutes spent creating a worktree, not the half-hour branch-checkout rebuild.
Pitfalls To Handle Before You Adopt Worktrees
Disk Space Multiplies Quickly
Each worktree contains full copies of the project’s Content and Intermediate folders. If your project is 60 GB, three worktrees can push you past 180 GB. Ease the pressure by pointing all worktrees at the same Derived Data Cache, storing large binary assets in Git LFS, and using short-lived worktrees for experiments. Windows NTFS will take the full size; macOS and Linux can use reflink-based copying in some filesystems, but you shouldn’t rely on it.
Run One Editor Per Worktree
A worktree is a single working tree, not a shared folder. Opening the same worktree in multiple Editor instances can cause file contention in Intermediate/ and Saved/. If you need more parallel work, create another worktree — don’t open the same one twice.
Git LFS Downloads Can Repeat
On a fresh worktree, the Git LFS smudge filter downloads the binary files for that branch. A large asset that exists in many branches will be downloaded once per worktree. That is still faster than a full Unreal build, and a local LFS cache server can help if bandwidth becomes a bottleneck.
Clean Up With git worktree prune
After manually deleting a worktree folder, run git worktree prune to remove stale administrative data. Use git worktree list to confirm which worktrees still exist before pruning.
Keep one important limitation in mind: worktrees don’t reduce merge conflicts. Two branches that both modify the same player controller will still produce a merge conflict when combined. Worktrees only remove the switching tax — they don’t make your teammates’ changes magically compatible.
Conclusion
Slow branch switches in Unreal Engine happen because Git changes files that Unreal then recompiles. Git worktrees for game dev eliminate that trigger by giving every branch a stable home and keeping build artifacts available exactly as long as the branch needs them. Use one worktree per branch, keep the Derived Data Cache shared, and you can hop from hotfix to feature without sitting through another full recompile.
