summaryrefslogtreecommitdiffstats
path: root/git-worktree.txt
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-09-18 18:16:46 -0700
committerJunio C Hamano <gitster@pobox.com>2020-09-18 18:16:46 -0700
commit5093e585a82e361cce2270aafd5f1b6954353021 (patch)
treef4264203033f4fda039d811c779e66e1f89228e4 /git-worktree.txt
parenta65d8e6d1bb62324eb42aa11f71b3d3a02fc8523 (diff)
downloadgit-htmldocs-5093e585a82e361cce2270aafd5f1b6954353021.tar.gz
Autogenerated HTML docs for v2.28.0-546-g385c1
Diffstat (limited to 'git-worktree.txt')
-rw-r--r--git-worktree.txt13
1 files changed, 13 insertions, 0 deletions
diff --git a/git-worktree.txt b/git-worktree.txt
index f70cda4b3..32e8440cd 100644
--- a/git-worktree.txt
+++ b/git-worktree.txt
@@ -32,6 +32,18 @@ A repository has one main working tree (if it's not a
bare repository) and zero or more linked working trees. When you are done
with a linked working tree, remove it with `git worktree remove`.
+In its simplest form, `git worktree add <path>` automatically creates a
+new branch whose name is the final component of `<path>`, which is
+convenient if you plan to work on a new topic. For instance, `git
+worktree add ../hotfix` creates new branch `hotfix` and checks it out at
+path `../hotfix`. To instead work on an existing branch in a new working
+tree, use `git worktree add <path> <branch>`. On the other hand, if you
+just plan to make some experimental changes or do testing without
+disturbing existing development, it is often convenient to create a
+'throwaway' working tree not associated with any branch. For instance,
+`git worktree add -d <path>` creates a new working tree with a detached
+`HEAD` at the same commit as the current branch.
+
If a working tree is deleted without using `git worktree remove`, then
its associated administrative files, which reside in the repository
(see "DETAILS" below), will eventually be removed automatically (see
@@ -164,6 +176,7 @@ To remove a locked working tree, specify `--force` twice.
exists. `-B` overrides this safeguard, resetting `<new-branch>` to
`<commit-ish>`.
+-d::
--detach::
With `add`, detach `HEAD` in the new working tree. See "DETACHED HEAD"
in linkgit:git-checkout[1].