summaryrefslogtreecommitdiff
path: root/Documentation/git-worktree.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/git-worktree.txt')
-rw-r--r--Documentation/git-worktree.txt15
1 files changed, 14 insertions, 1 deletions
diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt
index a50fbf8..9117e4f 100644
--- a/Documentation/git-worktree.txt
+++ b/Documentation/git-worktree.txt
@@ -208,7 +208,8 @@ REFS
----
In multiple working trees, some refs may be shared between all working
trees, some refs are local. One example is HEAD is different for all
-working trees. This section is about the sharing rules.
+working trees. This section is about the sharing rules and how to access
+refs of one working tree from another.
In general, all pseudo refs are per working tree and all refs starting
with "refs/" are shared. Pseudo refs are ones like HEAD which are
@@ -216,6 +217,18 @@ directly under GIT_DIR instead of inside GIT_DIR/refs. There are one
exception to this: refs inside refs/bisect and refs/worktree is not
shared.
+Refs that are per working tree can still be accessed from another
+working tree via two special paths, main-worktree and worktrees. The
+former gives access to per-worktree refs of the main working tree,
+while the latter to all linked working trees.
+
+For example, main-worktree/HEAD or main-worktree/refs/bisect/good
+resolve to the same value as the main working tree's HEAD and
+refs/bisect/good respectively. Similarly, worktrees/foo/HEAD or
+worktrees/bar/refs/bisect/bad are the same as
+GIT_COMMON_DIR/worktrees/foo/HEAD and
+GIT_COMMON_DIR/worktrees/bar/refs/bisect/bad.
+
To access refs, it's best not to look inside GIT_DIR directly. Instead
use commands such as linkgit:git-revparse[1] or linkgit:git-update-ref[1]
which will handle refs correctly.