aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/git-worktree.txt
diff options
context:
space:
mode:
authorThomas Gummerer <t.gummerer@gmail.com>2017-11-26 19:43:52 +0000
committerJunio C Hamano <gitster@pobox.com>2017-11-27 09:48:06 +0900
commitc4738aedc0aee085e25e20b6c32b9c4680f265d1 (patch)
tree016ce4bb1ba51bf5d3bf267aea497256c15d62c3 /Documentation/git-worktree.txt
parent7c85a87c5449f6495fe0327cfdcd1e0940d8545a (diff)
downloadgit-c4738aedc0aee085e25e20b6c32b9c4680f265d1.tar.gz
worktree: add can be created from any commit-ish
Currently 'git worktree add' is documented to take an optional <branch> 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 <rsbecker@nexbridge.com> Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-worktree.txt')
-rw-r--r--Documentation/git-worktree.txt20
1 files 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 <new-branch>] <path> [<branch>]
+'git worktree add' [-f] [--detach] [--checkout] [--lock] [-b <new-branch>] <path> [<commit-ish>]
'git worktree list' [--porcelain]
'git worktree lock' [--reason <string>] <worktree>
'git worktree prune' [-n] [-v] [--expire <expire>]
@@ -45,14 +45,14 @@ specifying `--reason` to explain why the working tree is locked.
COMMANDS
--------
-add <path> [<branch>]::
+add <path> [<commit-ish>]::
-Create `<path>` and checkout `<branch>` into it. The new working directory
+Create `<path>` and checkout `<commit-ish>` 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 `<branch>`; it is synonymous with `@{-1}`.
+specified as `<commit-ish>`; it is synonymous with `@{-1}`.
+
-If `<branch>` is omitted and neither `-b` nor `-B` nor `--detach` used,
+If `<commit-ish>` 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 <path>)` was specified.
@@ -84,25 +84,25 @@ OPTIONS
-f::
--force::
- By default, `add` refuses to create a new working tree when `<branch>`
+ By default, `add` refuses to create a new working tree when `<commit-ish>` is a branch name and
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.
+ `<commit-ish>`, and check out `<new-branch>` into the new working tree.
+ If `<commit-ish>` 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>`.
+ `<commit-ish>`.
--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 `<branch>`, however, `--no-checkout` can
+ By default, `add` checks out `<commit-ish>`, 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].