#readwise
# Git Worktree Documentation

## Metadata
- Author: [[git-scm.com]]
- Full Title: Git Worktree Documentation
- URL: https://git-scm.com/docs/git-worktree
## Highlights
A git repository can support multiple working trees, allowing you to check out more than one branch at a time. With `git worktree add` a new working tree is associated with the repository, along with additional metadata that differentiates that working tree from others in the same repository. The working tree, along with this metadata, is called a "worktree". ([View Highlight](https://read.readwise.io/read/01gmmx4wrxqwj8rd1xxfspvna5))
---
In its simplest form, `git worktree add <path>` automatically creates a new branch whose name is the final component of `<path>`, which is convenient if you plan to work on a new topic. For instance, `git worktree add ../hotfix` creates new branch `hotfix` and checks it out at path `../hotfix`. To instead work on an existing branch in a new worktree, use `git worktree add <path> <branch>`. On the other hand, if you just plan to make some experimental changes or do testing without disturbing existing development, it is often convenient to create a *throwaway* worktree not associated with any branch. For instance, `git worktree add -d <path>` creates a new worktree with a detached `HEAD` at the same commit as the current branch. ([View Highlight](https://read.readwise.io/read/01gmmx6fc9nhawxc044m9kqgkg))
---