@@ -11,6 +11,7 @@ SYNOPSIS
1111[verse]
1212'git worktree add' [-f] [--detach] [--checkout] [-b <new-branch>] <path> [<branch>]
1313'git worktree list' [--porcelain]
14+ 'git worktree lock' [--reason <string>] <worktree>
1415'git worktree prune' [-n] [-v] [--expire <expire>]
1516
1617DESCRIPTION
@@ -38,9 +39,8 @@ section "DETAILS" for more information.
3839
3940If a linked working tree is stored on a portable device or network share
4041which is not always mounted, you can prevent its administrative files from
41- being pruned by creating a file named 'locked' alongside the other
42- administrative files, optionally containing a plain text reason that
43- pruning should be suppressed. See section "DETAILS" for more information.
42+ being pruned by issuing the `git worktree lock` command, optionally
43+ specifying `--reason` to explain why the working tree is locked.
4444
4545COMMANDS
4646--------
@@ -61,6 +61,14 @@ each of the linked worktrees. The output details include if the worktree is
6161bare, the revision currently checked out, and the branch currently checked out
6262(or 'detached HEAD' if none).
6363
64+ lock::
65+
66+ If a working tree is on a portable device or network share which
67+ is not always mounted, lock it to prevent its administrative
68+ files from being pruned automatically. This also prevents it from
69+ being moved or deleted. Optionally, specify a reason for the lock
70+ with `--reason`.
71+
6472prune::
6573
6674Prune working tree information in $GIT_DIR/worktrees.
@@ -110,6 +118,13 @@ OPTIONS
110118--expire <time>::
111119 With `prune`, only expire unused working trees older than <time>.
112120
121+ --reason <string>::
122+ With `lock`, an explanation why the working tree is locked.
123+
124+ <worktree>::
125+ Working trees can be identified by path, either relative or
126+ absolute.
127+
113128DETAILS
114129-------
115130Each linked working tree has a private sub-directory in the repository's
@@ -150,7 +165,8 @@ instead.
150165
151166To prevent a $GIT_DIR/worktrees entry from being pruned (which
152167can be useful in some situations, such as when the
153- entry's working tree is stored on a portable device), add a file named
168+ entry's working tree is stored on a portable device), use the
169+ `git worktree lock` command, which adds a file named
154170'locked' to the entry's directory. The file contains the reason in
155171plain text. For example, if a linked working tree's `.git` file points
156172to `/path/main/.git/worktrees/test-next` then a file named
@@ -226,8 +242,6 @@ performed manually, such as:
226242- `remove` to remove a linked working tree and its administrative files (and
227243 warn if the working tree is dirty)
228244- `mv` to move or rename a working tree and update its administrative files
229- - `lock` to prevent automatic pruning of administrative files (for instance,
230- for a working tree on a portable device)
231245
232246GIT
233247---
0 commit comments