Documentation/git-worktree: add high-level 'lock' overview

Due to the (current) absence of a "git worktree lock" command, locking
a worktree's administrative files to prevent automatic pruning is a
manual task, necessarily requiring low-level understanding of linked
worktree functionality. However, this level of detail does not belong
in the high-level DESCRIPTION section, so add a generalized discussion
of locking to DESCRIPTION and move the technical information to DETAILS.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Eric Sunshine
2015-07-06 13:30:43 -04:00
committed by Junio C Hamano
parent af189b4cbe
commit a8ba5dd7b1

View File

@ -37,15 +37,11 @@ at least one git command inside the linked working directory
(e.g. `git status`) in order to update its administrative files in the (e.g. `git status`) in order to update its administrative files in the
repository so that they do not get automatically pruned. repository so that they do not get automatically pruned.
To prevent a $GIT_DIR/worktrees entry from from being pruned (which If a linked working tree is stored on a portable device or network share
can be useful in some situations, such as when the which is not always mounted, you can prevent its administrative files from
entry's working tree is stored on a portable device), add a file named being pruned by creating a file named 'lock' alongside the other
'locked' to the entry's directory. The file contains the reason in administrative files, optionally containing a plain text reason that
plain text. For example, if a linked working tree's `.git` file points pruning should be suppressed. See section "DETAILS" for more information.
to `/path/main/.git/worktrees/test-next` then a file named
`/path/main/.git/worktrees/test-next/locked` will prevent the
`test-next` entry from being pruned. See
linkgit:gitrepository-layout[5] for details.
COMMANDS COMMANDS
-------- --------
@ -99,6 +95,16 @@ 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.
To prevent a $GIT_DIR/worktrees entry from from being pruned (which
can be useful in some situations, such as when the
entry's working tree is stored on a portable device), add a file named
'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
to `/path/main/.git/worktrees/test-next` then a file named
`/path/main/.git/worktrees/test-next/locked` will prevent the
`test-next` entry from being pruned. See
linkgit:gitrepository-layout[5] for details.
BUGS BUGS
---- ----
Multiple checkout support for submodules is incomplete. It is NOT Multiple checkout support for submodules is incomplete. It is NOT