GitWorktree.org logoGitWorktree.org

Working Tree vs Worktree: What Is the Difference in Git?

These two terms look almost identical, but they refer to different levels of the same concept. A working treeis the directory where your tracked files live — every Git repository has one by default. The git worktree command lets you create additional working trees, each with its own checkout (a branch or detached HEAD). Understanding the distinction clears up a lot of Git confusion.

The Short Answer

TermWhat it means
Working treeThe directory on disk where Git checks out your files. Every clone has one. Git documentation also calls this the "work tree" or "working directory."
git worktreeA Git command (since Git 2.5) that creates additional working trees linked to the same repository. Each linked worktree has its own checkout (a branch or detached HEAD) and index.

In other words: every git worktree creates a new working tree. But the term "working tree" existed long before the git worktree command — it is a fundamental Git concept, not a feature you have to opt into.

What Is a Working Tree in Git?

When you git clone or git init a repository, Git creates two things:

  1. The .git directory— stores all commits, branches, tags, and configuration. This is the repository itself.
  2. The working tree— the directory of checked-out files that you actually edit. This is everything outside .git.
Working tree vs .git directory
my-project/          # ← this entire directory is the working tree
├── .git/            # ← the repository (not part of the working tree)
├── src/
│   └── index.ts
├── package.json
└── README.md

The working tree is where you edit files, run builds, and test your code. When you run git status, Git compares the working tree against the index (staging area) and the latest commit to show you what has changed.

What Is a Worktree (git worktree)?

The git worktree command lets you create additional working trees linked to the same repository. Each one checks out a different branch into a separate directory, while sharing the same Git history and objects.

Creating a second working tree
# Your main working tree (on the feature branch)
$ pwd
/home/user/my-project

# Create an additional working tree for a hotfix
$ git worktree add -b hotfix/crash ../my-project-hotfix main

# Now you have two working trees:
$ git worktree list
/home/user/my-project          a1b2c3d [feature/dashboard]
/home/user/my-project-hotfix   d4e5f6a [hotfix/crash]

The original directory (/home/user/my-project) is called the main worktree. Any additional ones are linked worktrees. They all share the same .git object store, so branches and commits created in one are immediately visible in the others.

Detailed Comparison

AspectWorking Treegit worktree (command)
TypeGit concept / anatomyGit command
Exists sinceGit 1.0 (always)Git 2.5 (July 2015)
How many?Every non-bare repo has one main working tree by default, plus zero or more linked working treesLets you add as many additional working trees as you need
CreationAutomatic on git clone / git initExplicit: git worktree add
Error messages"not a working tree", "must be run in a work tree""already checked out", "is not a working tree"
Bare reposBare repos have no working treeYou can add worktrees to bare repos

Why the Confusion?

Git's own documentation uses the terms inconsistently. You will see "work tree," "working tree," "working directory," and "worktree" all used in different contexts. Here is how they map:

  • "working tree" and "work tree"— the checked-out file directory. Used in error messages like fatal: this operation must be run in a work tree.
  • "worktree"(one word) — usually refers to the git worktree command or a linked worktree created by it.
  • "working directory"— an older synonym for working tree, still used in some Git docs and tutorials.

In practice, when someone says "worktree" they almost always mean the git worktree feature. When Git itself says "working tree" or "work tree" in an error message, it means your checkout directory.

How They Relate in Practice

One repository, two working trees
# Clone a repo — this creates a .git directory and a working tree
git clone https://github.com/example/app.git
cd app

# You are now in the main working tree
# (it has a .git/ directory with all the repo data)

# Create a linked worktree — this creates a second working tree
git worktree add -b fix/bug ../app-fix main

# Now there are two working trees:
# /home/user/app       → main working tree (feature/x checked out)
# /home/user/app-fix   → linked working tree (fix/bug checked out)

# Both share the same .git repository
# Commits in one are visible from the other

Common Error Messages Explained

"fatal: this operation must be run in a work tree"

You are inside a bare repository or a .git directory that has no checked-out files. Navigate to a directory with a working tree, or use git worktree add to create one. See troubleshooting: must be run in work tree.

"fatal: 'main' is already checked out"

You tried to check out a branch that is already checked out in another working tree. Git does not allow this because two working trees cannot share a branch. Use a different branch name, or remove the other worktree first. See troubleshooting: already checked out.

Frequently Asked Questions

What is a worktree in Git?

A worktree is a working tree (a directory with checked-out files) linked to a Git repository. Every repo has a main worktree. The git worktree command lets you create additional linked worktrees for parallel development. See what is git worktree for a full introduction.

Is "working tree" the same as "working directory"?

Yes, in Git's context they mean the same thing. Older Git documentation preferred "working directory," but modern Git uses "working tree" to avoid confusion with the shell concept of a current working directory (pwd).

Do I need to use git worktree to have a working tree?

No. Every non-bare repository already has a working tree. You only need the git worktree command when you want additional working trees for parallel branch work.

What is the difference between a bare repo and a working tree?

A bare repository contains only the .git data (commits, branches, objects) with no working tree at all. You cannot edit files directly in a bare repo. You can, however, use git worktree add to create working trees from a bare repo. See our bare repository guide.

Summary

A working tree is the directory where Git checks out your files. The git worktree command creates additional working trees for parallel development. Every repository has one main working tree by default; the command lets you add more.

You Might Also Like