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 by another working tree. This option overrides that safeguard. |
-b <new-branch>
-B <new-branch>
| With add, create a new branch named <new-branch>
starting at <branch>
, and check out <new-branch>
into the new working tree. If <branch>
is omitted, it defaults to HEAD
. By default, -b
refuses to create a new branch if it already exists. -B
overrides this safeguard, resetting <new-branch>
to <branch>
. |
–detach | With add, detach HEAD
in the new working tree. |
–[no-] checkout | By default, add checks out <branch>
, however, --no-checkout
can be used to suppress checkout in order to make customizations, such as configuring sparse-checkout. |
-n –dry-run | With prune, do not remove anything; just report what it would remove. |
–porcelain | With list, output in an easy-to-parse format for scripts. This format will remain stable across Git versions and regardless of user configuration. |
-v –verbose | With prune, report all removals. |
–expire <time>
| With prune, only expire unused working trees older than <time>
. |
Remarks
See the official documentation for more information: https://git-scm.com/docs/git-worktree.