From c4738aedc0aee085e25e20b6c32b9c4680f265d1 Mon Sep 17 00:00:00 2001 From: Thomas Gummerer Date: Sun, 26 Nov 2017 19:43:52 +0000 Subject: [PATCH] worktree: add can be created from any commit-ish Currently 'git worktree add' is documented to take an optional argument, which is checked out in the new worktree. However it is more generally possible to use a commit-ish as the optional argument, and check that out into the new worktree. Document that this is a possibility, as new users of git worktree add might find it helpful. Reported-by: Randall S. Becker Signed-off-by: Thomas Gummerer Signed-off-by: Junio C Hamano --- Documentation/git-worktree.txt | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt index b472acc356..121895209d 100644 --- a/Documentation/git-worktree.txt +++ b/Documentation/git-worktree.txt @@ -9,7 +9,7 @@ git-worktree - Manage multiple working trees SYNOPSIS -------- [verse] -'git worktree add' [-f] [--detach] [--checkout] [--lock] [-b ] [] +'git worktree add' [-f] [--detach] [--checkout] [--lock] [-b ] [] 'git worktree list' [--porcelain] 'git worktree lock' [--reason ] 'git worktree prune' [-n] [-v] [--expire ] @@ -45,14 +45,14 @@ specifying `--reason` to explain why the working tree is locked. COMMANDS -------- -add []:: +add []:: -Create `` and checkout `` into it. The new working directory +Create `` and checkout `` into it. The new working directory is linked to the current repository, sharing everything except working directory specific files such as HEAD, index, etc. `-` may also be -specified as ``; it is synonymous with `@{-1}`. +specified as ``; it is synonymous with `@{-1}`. + -If `` is omitted and neither `-b` nor `-B` nor `--detach` used, +If `` is omitted and neither `-b` nor `-B` nor `--detach` used, then, as a convenience, a new branch based at HEAD is created automatically, as if `-b $(basename )` was specified. @@ -84,25 +84,25 @@ OPTIONS -f:: --force:: - By default, `add` refuses to create a new working tree when `` + By default, `add` refuses to create a new working tree when `` is a branch name and is already checked out by another working tree. This option overrides that safeguard. -b :: -B :: With `add`, create a new branch named `` starting at - ``, and check out `` into the new working tree. - If `` is omitted, it defaults to HEAD. + ``, and check out `` into the new working tree. + If `` is omitted, it defaults to HEAD. By default, `-b` refuses to create a new branch if it already exists. `-B` overrides this safeguard, resetting `` to - ``. + ``. --detach:: With `add`, detach HEAD in the new working tree. See "DETACHED HEAD" in linkgit:git-checkout[1]. --[no-]checkout:: - By default, `add` checks out ``, however, `--no-checkout` can + By default, `add` checks out ``, however, `--no-checkout` can be used to suppress checkout in order to make customizations, such as configuring sparse-checkout. See "Sparse checkout" in linkgit:git-read-tree[1]. -- 2.11.4.GIT