summaryrefslogtreecommitdiff
path: root/Documentation/git-worktree.txt
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-05-23 05:38:18 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-23 05:38:18 (GMT)
commit10174da9f1643eb939d93d479547494baf77377b (patch)
tree7984b987bc20e55d21c26d83569eabb11928256d /Documentation/git-worktree.txt
parent352cf6cfe138b1dbcf9c105c91ca793b67511d7b (diff)
parentf60a7b763fe070161b332d3878f81a7f09ab6e44 (diff)
downloadgit-10174da9f1643eb939d93d479547494baf77377b.zip
git-10174da9f1643eb939d93d479547494baf77377b.tar.gz
git-10174da9f1643eb939d93d479547494baf77377b.tar.bz2
Merge branch 'tg/worktree-add-existing-branch'
"git worktree add" learned to check out an existing branch. * tg/worktree-add-existing-branch: worktree: teach "add" to check out existing branches worktree: factor out dwim_branch function worktree: improve message when creating a new worktree worktree: remove extra members from struct add_opts
Diffstat (limited to 'Documentation/git-worktree.txt')
-rw-r--r--Documentation/git-worktree.txt9
1 files changed, 7 insertions, 2 deletions
diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt
index 9920d9c..afc6576 100644
--- a/Documentation/git-worktree.txt
+++ b/Documentation/git-worktree.txt
@@ -61,8 +61,13 @@ $ git worktree add --track -b <branch> <path> <remote>/<branch>
------------
+
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.
+then, as a convenience, the new worktree is associated with a branch
+(call it `<branch>`) named after `$(basename <path>)`. If `<branch>`
+doesn't exist, a new branch based on HEAD is automatically created as
+if `-b <branch>` was given. If `<branch>` does exist, it will be
+checked out in the new worktree, if it's not checked out anywhere
+else, otherwise the command will refuse to create the worktree (unless
+`--force` is used).
list::