You're halfway through a native iOS feature when a bug needs fixing on the release branch. A view is unfinished, your changes aren't ready to commit, and your first thought is to use git stash to save your work.
Git worktrees let you keep multiple working directories attached to the same repository, with different branches checked out at the same time. You can open the release code in another folder and leave your feature where it is, as explained in the Git worktree docs.

What Are Git Worktrees?
The project folder you normally edit is already a working tree. A linked worktree adds another working directory to the same repository, starting from committed code. Your main folder could stay on feature/profile, while a second folder checks out hotfix/login.
Each has its own source files, HEAD, and index, which holds staged changes. The repository's objects and branch references are shared.

You still make commits, review diffs, and merge branches through your usual Git workflow.
Git Worktrees vs. Branches: What's the Difference?
A branch identifies a line of development: a reference that moves forward as you commit. A worktree is the directory where a version of that code is checked out. Creating a branch alone doesn't create another folder.
You use branches with worktrees. The choice is usually whether to switch branches in one checkout or keep several checkouts available.
Approach | Available checkouts | Repository data | When to use it |
|---|---|---|---|
Switch branches in one folder | One at a time | One repository | Work happens sequentially |
Add worktrees | Several at once | Shared objects and branch references | Tasks need separate working folders |
Use separate clones | Several at once | Separate repositories | Independent repository configuration matters |
If you clone the repo again, you get another checkout, but you also need to manage that repository’s local branches, configuration, and fetches separately.
Clones generally duplicate more repository data, although Git supports storage optimizations for local clones. For parallel tasks within one project, worktrees often involve less duplication.
When Should an iOS Developer Use Git Worktrees?
An urgent fix is the clearest example. Suppose your feature changes the login screen, but a production bug exists in the current release. Investigating from the release code helps you avoid accidentally relying on behavior introduced by your unfinished feature. You can compare the two implementations without repeatedly replacing the files in your active folder.
Reviews benefit too. A colleague's pull request might need a build and a few minutes in the app. Its own checkout gives you a place to reproduce the reported behavior, compare it with the release, and leave feedback against the code you actually ran.
Another case is keeping two features available. You might be waiting for feedback on a settings screen while starting a separate accessibility improvement. Both can remain easy to revisit.
Worktrees make sense when tasks regularly overlap and each needs a place to build, run, or review the code. A checkout you revisit for release fixes or ongoing reviews is especially useful. If you finish one task before starting the next, switching branches in a single folder may already suit your workflow.
Using Git Worktrees with Claude Code and Parallel Coding Agents
The same idea applies when you run parallel Claude Code sessions: each session can work in its own checkout.
For example, one agent could update accessibility labels while another adds tests for a parser. Separate folders prevent their ordinary file edits from landing in the same working copy. You can inspect each task's diff before deciding what to merge.
Flowdeck Studio helps developers build and test Claude Code changes in parallel, giving each session its own Git worktree, build directory, and simulator to validate the results before code review. For a practical walkthrough, see How to Run Multiple Claude Code Agents on the Same Xcode Project.
Choose tasks with clear boundaries. Use each session's build results, test output, simulator state, and logs to review the changes alongside its diff.
Getting Your New Worktree Ready
Once you've chosen a task for another worktree, prepare that checkout as you would a fresh copy of the project. Check its branch, local configuration, dependencies, and first build before relying on it for a review or handing it to an agent.
Choose the branch and open the right folder
By default, Git refuses to check out a branch that's already checked out in another worktree. Use a different branch for each task, or a detached checkout to inspect the same commit.
The scheme name won't tell you which checkout you're building. Two Xcode windows can both show MyApp, even when one contains your feature and the other the release fix. Check the folder path and branch before Build or Run, then confirm the simulator destination. A successful build from the wrong checkout is still the wrong build.
Restore local files and dependencies
Untracked and gitignored files aren't copied into a new worktree. That includes local files such as a secrets .xcconfig, GoogleService-Info.plist, or project-specific .env. The new checkout may not build until you restore those files through your team's normal setup process.
For projects using Swift Package Manager, Xcode also needs to prepare dependencies for the new checkout. Commit Package.resolved so Xcode can use the project's recorded dependency versions. Xcode's per-user package cache can avoid downloading them again. A new worktree needs its own package setup, but that doesn't mean upgrading packages or fetching everything from scratch.
If your project keeps Pods/ out of Git, run pod install in each new worktree to recreate its dependencies and integration files. Keep Podfile.lock committed so the installation uses the expected versions. Projects that commit Pods/ already bring those files into the checkout
Allow for the first build and indexing
By default, Xcode creates a unique DerivedData folder using the project's or workspace's name and location. Each worktree's different path therefore gives it separate build data.
The practical cost is a cold start for that checkout: Xcode needs to populate its build products and indexes. Budget for the first build and indexing before that quick review is ready. With compilation caching enabled, Xcode can reuse matching compilation results to reduce that work.
Allow disk space for the new checkout and its build data. Keep worktrees for active tasks and remove them when they're no longer needed.
What Git Worktrees Don't Isolate in Xcode
Even with source files in separate folders, Xcode's build output and simulator state still need attention. Shared paths and runtime resources can affect both tasks, and their changes will eventually need to be combined
Shared build paths and resources
Custom build output paths can override the default separation. If two builds write to the same absolute directory, give them separate output locations.
Shared test accounts and local services also need coordination. Two app instances using the same backend account can affect each other's test data. Concurrent builds compete for your Mac's resources, even when their output directories are separate.
Simulators and installed apps
A simulator device doesn't belong to a Git branch. Two checkouts can target the same device and install an app with the same bundle identifier.
In How to Run Multiple Claude Code Agents on the Same Xcode Project, two worktrees targeted one simulator. The second installation replaced the first build while the app's saved UserDefaults data remained. The app on screen can therefore stop matching the checkout you're reviewing.
For concurrent runs, assign one simulator per worktree. Clone a shut-down base device with xcrun simctl clone, then target each clone by UDID using xcodebuild with -destination 'platform=iOS Simulator,id=<UDID>'. Use that same UDID for installation and launch commands, and in agent instructions. Giving devices different names won't help if both tasks still target the same device.
Cloning copies the base device's installed apps and data. Start from a base whose state suits your tests; a clone isn't automatically a blank device.
Sequential work can reuse a simulator, provided you account for the installed build and any saved app data
Merge conflicts
Worktrees leave Git's merge behavior intact. Different edits to the same lines can still conflict when branches are combined. That applies to Swift files and shared project configuration alike. Separate folders keep edits apart during development; integration still needs review.

Conclusion
Try a worktree for your next hotfix or pull request review. Prepare the local files and dependencies, allow time for the first build, and confirm you're running the intended checkout on the right simulator. Use that first task to decide whether keeping another working folder ready fits your workflow. Before merging, review and test the combined changes.
Q&A
Does removing a worktree delete its branch?
Does every worktree need its own simulator?
Can agent changes merge cleanly and still break the app?
Are worktrees required to run multiple coding agents?
Further reading
#ai-agents
#claude-code
#codex
#comparison
#ios-development




