Term
Git Worktree
Git worktree allows you to have multiple branches of a repo checked out simultaneously in different directories — without stashing or constant branch-switching.
Git Worktree — explained in more detail
By default, a Git repository has only one active working tree — the directory holding the files of the current branch. Whoever wants to look at another branch must git checkout, which risks all unsaved changes or forces a stash.
What worktrees solve
With git worktree add ../foo-feature feature-branch, Git creates a second working directory based on the same repository. Both directories share the object database under .git/, but have independent working trees — different branches, separate builds, parallel test runs.
Typical use cases
- Hotfix during feature work: main directory on the feature branch, second worktree on
mainfor the bugfix. - Code review: check out the reviewer branch in a second worktree without losing your own state.
- Parallel AI sessions: every AI instance works in its own worktree — no lock conflicts, no shared build cache.
Constraint
A branch cannot be checked out in two worktrees at the same time. Whoever tries gets an error message — which protects against duplicate work on the same branch.
Entdecke mehr
Git Branch
A branch is an independent line of development in a Git repository — a moving pointer to a commit, allowing parallel work without conflicts with the main code.
LexikonGit Basics for Non-Developers
What version control is, what problem Git solves, and the mental model behind it: repository, commit, branch, merge, and remote, explained plainly.
GlossarGitHub
GitHub is the largest hosting platform for Git repositories — with pull requests, code review, issues and CI/CD via GitHub Actions as the standard toolkit for software development.