X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=Documentation%2Fgit-worktree.txt;h=9117e4fb50810801fd1a82ef93eb4b76fc9491c1;hb=3a3b9d8cde4ed647b1c56a8097f6db8e269bbc71;hp=a50fbf80948a481ed64cce1bd11dbf00f6eba76b;hpb=8aff1a9ca5a266020fe5b1bd8c54228581e34530;p=thirdparty%2Fgit.git diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt index a50fbf8094..9117e4fb50 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.