All docs

Work on two branches with Git worktrees

Create a second checkout for a hotfix or review while keeping your main working folder available.

When a worktree helps

A linked worktree is another folder for the same repository. Each checkout has its own working files and staging area. Both see the shared commit history and references. For example, leave an unfinished search change in C:\Dev\orbit and fix a production issue in C:\Dev\orbit-hotfix.

See multiple worktrees in one graph

MoonGit shows multiple worktrees together in one commit graph. You can follow their branch tips, working changes and connections without switching between separate history views. The Worktree column identifies the checkout associated with a row; a working-changes row belongs to that checkout, not every worktree in the repository.

One commit graph with several named worktrees and their working changes
Read the Worktree column on the right: activity-feed, release-1.2, onboarding, session-fix, dashboard and keyboard-focus all appear in the same graph. The sample repository has several parallel checkouts. Open full-size image

Use the graph to understand the shared history, then verify the active checkout's folder and branch before staging, committing or opening Git CLI. Each worktree still has its own working files and index. A visible branch label alone does not change where a command runs.

Manage the checkout folders

Worktrees panel with multiple checkout folders and branches
Check the folder and branch together in the Worktrees list. They identify where your next operation will run. Open full-size image

Create and open a checkout

  1. Open Worktrees in the repository. Enable it in Settings → Advanced features if the tool is hidden.
  2. Choose the starting branch, select Create a new branch, enter hotfix/login, and choose the separate destination folder.
  3. Select Create worktree. Open the new checkout and verify its branch and folder before staging. The unfinished changes remain in the original checkout.

Git generally prevents a branch from being checked out in two worktrees at once. Create a new branch from the same commit if you need both folders.

Retire a worktree safely

Action What to inspect
Remove… Check the selected folder, changes, unfinished operations, and any ignored paths in the confirmation. Manual removal can delete the listed ignored files with the folder.
Clean up merged worktrees… Verify the comparison branch and the selected folders in the preview. This cleanup keeps checkouts with ignored files.
Remove stale registrations… Check that the folders are already gone. The cleanup removes their Git registrations.

If MoonGit reports work in progress or an unverified checkout, open the affected folder and address that state before retrying.

Review branches for cleanup · Stash unfinished work

More docs