Skip to content

Commit 4f39292

Browse files
committed
Merge branch 'sb/doc-worktree-prune-expire-improvement'
The help text and the documentation for the "--expire" option of "git worktree [list|prune]" have been improved. * sb/doc-worktree-prune-expire-improvement: worktree: clarify that --expire only affects missing worktrees
2 parents 6176ee2 + 6f5ca70 commit 4f39292

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

Documentation/git-worktree.adoc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,13 @@ with linked worktrees if you move the main worktree manually.)
131131

132132
`prune`::
133133

134-
Prune worktree information in `$GIT_DIR/worktrees`.
134+
Remove worktree information in `$GIT_DIR/worktrees` for worktrees
135+
whose working trees are missing. Useful after manually removing
136+
a working tree that is no longer needed (but use "git worktree
137+
remove" next time you want to do so). Also, if you _moved_ a
138+
working tree elsewhere causing the worktree information to become
139+
dangling, see "git worktree repair" to reconnect the worktree to
140+
the new working tree location.
135141

136142
`remove`::
137143

@@ -271,7 +277,7 @@ mismatch, even if the links are correct.
271277
With `list`, output additional information about worktrees (see below).
272278

273279
`--expire <time>`::
274-
With `prune`, only expire unused worktrees older than _<time>_.
280+
With `prune`, only prune missing worktrees if older than _<time>_.
275281
+
276282
With `list`, annotate missing worktrees as prunable if they are older than
277283
_<time>_.

builtin/worktree.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ static int prune(int ac, const char **av, const char *prefix,
252252
OPT__DRY_RUN(&show_only, N_("do not remove, show only")),
253253
OPT__VERBOSE(&verbose, N_("report pruned working trees")),
254254
OPT_EXPIRY_DATE(0, "expire", &expire,
255-
N_("expire working trees older than <time>")),
255+
N_("prune missing working trees older than <time>")),
256256
OPT_END()
257257
};
258258

@@ -1070,7 +1070,7 @@ static int list(int ac, const char **av, const char *prefix,
10701070
OPT_BOOL(0, "porcelain", &porcelain, N_("machine-readable output")),
10711071
OPT__VERBOSE(&verbose, N_("show extended annotations and reasons, if available")),
10721072
OPT_EXPIRY_DATE(0, "expire", &expire,
1073-
N_("add 'prunable' annotation to worktrees older than <time>")),
1073+
N_("add 'prunable' annotation to missing worktrees older than <time>")),
10741074
OPT_SET_INT('z', NULL, &line_terminator,
10751075
N_("terminate records with a NUL character"), '\0'),
10761076
OPT_END()

0 commit comments

Comments
 (0)