Worktrees
suggest changeSyntax
git worktree add [-f] [--detach] [--checkout] [-b <new-branch>] <path> [<branch>]git worktree prune [-n] [-v] [--expire <expire>]git worktree list [--porcelain]
Parameters
| Parameter | Details |
|---|---|
-f, --force |
By default, add refuses to create a new working tree when <branch> is already checked out elsewhere. This option overrides that safeguard. |
-b <new-branch>, -B <new-branch> |
With add, create <new-branch> starting at <branch> and check it out in the new working tree. If <branch> is omitted, it defaults to HEAD. -b refuses to create a branch that already exists. -B resets <new-branch> to <branch>. |
--detach |
With add, detach HEAD in the new working tree. |
--[no-]checkout |
add checks out <branch> unless you pass --no-checkout, for example so you can set up sparse checkout first. |
-n, --dry-run |
With prune, report what would be removed and remove nothing. |
--porcelain |
With list, print a stable format for scripts. |
-v, --verbose |
With prune, report every removal. |
--expire <time> |
With prune, expire unused working trees older than <time>. |
Remarks
See the official documentation for more information: https://git-scm.com/docs/git-worktree.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents