worktree: use 'worktree' over 'working tree'
It is helpful to distinguish between a 'working tree' and a 'worktree'. A worktree contains a working tree plus additional metadata. This metadata includes per-worktree refs and worktree-specific config. This is the sixth of multiple changes to git-worktree.txt, restricted to the DETAILS section. Signed-off-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
7b215826f3
commit
f13a146c81
@ -319,29 +319,29 @@ linkgit:git-config[1] for more details.
|
|||||||
|
|
||||||
DETAILS
|
DETAILS
|
||||||
-------
|
-------
|
||||||
Each linked working tree has a private sub-directory in the repository's
|
Each linked worktree has a private sub-directory in the repository's
|
||||||
`$GIT_DIR/worktrees` directory. The private sub-directory's name is usually
|
`$GIT_DIR/worktrees` directory. The private sub-directory's name is usually
|
||||||
the base name of the linked working tree's path, possibly appended with a
|
the base name of the linked worktree's path, possibly appended with a
|
||||||
number to make it unique. For example, when `$GIT_DIR=/path/main/.git` the
|
number to make it unique. For example, when `$GIT_DIR=/path/main/.git` the
|
||||||
command `git worktree add /path/other/test-next next` creates the linked
|
command `git worktree add /path/other/test-next next` creates the linked
|
||||||
working tree in `/path/other/test-next` and also creates a
|
worktree in `/path/other/test-next` and also creates a
|
||||||
`$GIT_DIR/worktrees/test-next` directory (or `$GIT_DIR/worktrees/test-next1`
|
`$GIT_DIR/worktrees/test-next` directory (or `$GIT_DIR/worktrees/test-next1`
|
||||||
if `test-next` is already taken).
|
if `test-next` is already taken).
|
||||||
|
|
||||||
Within a linked working tree, `$GIT_DIR` is set to point to this private
|
Within a linked worktree, `$GIT_DIR` is set to point to this private
|
||||||
directory (e.g. `/path/main/.git/worktrees/test-next` in the example) and
|
directory (e.g. `/path/main/.git/worktrees/test-next` in the example) and
|
||||||
`$GIT_COMMON_DIR` is set to point back to the main working tree's `$GIT_DIR`
|
`$GIT_COMMON_DIR` is set to point back to the main worktree's `$GIT_DIR`
|
||||||
(e.g. `/path/main/.git`). These settings are made in a `.git` file located at
|
(e.g. `/path/main/.git`). These settings are made in a `.git` file located at
|
||||||
the top directory of the linked working tree.
|
the top directory of the linked worktree.
|
||||||
|
|
||||||
Path resolution via `git rev-parse --git-path` uses either
|
Path resolution via `git rev-parse --git-path` uses either
|
||||||
`$GIT_DIR` or `$GIT_COMMON_DIR` depending on the path. For example, in the
|
`$GIT_DIR` or `$GIT_COMMON_DIR` depending on the path. For example, in the
|
||||||
linked working tree `git rev-parse --git-path HEAD` returns
|
linked worktree `git rev-parse --git-path HEAD` returns
|
||||||
`/path/main/.git/worktrees/test-next/HEAD` (not
|
`/path/main/.git/worktrees/test-next/HEAD` (not
|
||||||
`/path/other/test-next/.git/HEAD` or `/path/main/.git/HEAD`) while `git
|
`/path/other/test-next/.git/HEAD` or `/path/main/.git/HEAD`) while `git
|
||||||
rev-parse --git-path refs/heads/master` uses
|
rev-parse --git-path refs/heads/master` uses
|
||||||
`$GIT_COMMON_DIR` and returns `/path/main/.git/refs/heads/master`,
|
`$GIT_COMMON_DIR` and returns `/path/main/.git/refs/heads/master`,
|
||||||
since refs are shared across all working trees, except `refs/bisect` and
|
since refs are shared across all worktrees, except `refs/bisect` and
|
||||||
`refs/worktree`.
|
`refs/worktree`.
|
||||||
|
|
||||||
See linkgit:gitrepository-layout[5] for more information. The rule of
|
See linkgit:gitrepository-layout[5] for more information. The rule of
|
||||||
@ -349,8 +349,8 @@ thumb is do not make any assumption about whether a path belongs to
|
|||||||
`$GIT_DIR` or `$GIT_COMMON_DIR` when you need to directly access something
|
`$GIT_DIR` or `$GIT_COMMON_DIR` when you need to directly access something
|
||||||
inside `$GIT_DIR`. Use `git rev-parse --git-path` to get the final path.
|
inside `$GIT_DIR`. Use `git rev-parse --git-path` to get the final path.
|
||||||
|
|
||||||
If you manually move a linked working tree, you need to update the `gitdir` file
|
If you manually move a linked worktree, you need to update the `gitdir` file
|
||||||
in the entry's directory. For example, if a linked working tree is moved
|
in the entry's directory. For example, if a linked worktree is moved
|
||||||
to `/newpath/test-next` and its `.git` file points to
|
to `/newpath/test-next` and its `.git` file points to
|
||||||
`/path/main/.git/worktrees/test-next`, then update
|
`/path/main/.git/worktrees/test-next`, then update
|
||||||
`/path/main/.git/worktrees/test-next/gitdir` to reference `/newpath/test-next`
|
`/path/main/.git/worktrees/test-next/gitdir` to reference `/newpath/test-next`
|
||||||
@ -359,10 +359,10 @@ automatically.
|
|||||||
|
|
||||||
To prevent a `$GIT_DIR/worktrees` entry from being pruned (which
|
To prevent a `$GIT_DIR/worktrees` entry from being pruned (which
|
||||||
can be useful in some situations, such as when the
|
can be useful in some situations, such as when the
|
||||||
entry's working tree is stored on a portable device), use the
|
entry's worktree is stored on a portable device), use the
|
||||||
`git worktree lock` command, which adds a file named
|
`git worktree lock` command, which adds a file named
|
||||||
`locked` to the entry's directory. The file contains the reason in
|
`locked` to the entry's directory. The file contains the reason in
|
||||||
plain text. For example, if a linked working tree's `.git` file points
|
plain text. For example, if a linked worktree's `.git` file points
|
||||||
to `/path/main/.git/worktrees/test-next` then a file named
|
to `/path/main/.git/worktrees/test-next` then a file named
|
||||||
`/path/main/.git/worktrees/test-next/locked` will prevent the
|
`/path/main/.git/worktrees/test-next/locked` will prevent the
|
||||||
`test-next` entry from being pruned. See
|
`test-next` entry from being pruned. See
|
||||||
|
Reference in New Issue
Block a user