From: Eric Sunshine Date: Mon, 13 Nov 2017 17:39:05 GMT Subject: Re: man page for "git-worktree" is a bit confusing WRT "prune" Message-ID: In-Reply-To: On Mon, Nov 13, 2017 at 9:48 AM, Robert P. J. Day wrote: > once more, into the man pages ... "git worktree" seems like a fairly > simple command, but there is some confusion about the function of > > $ git worktree prune > > the normal meaning of "prune" (certainly with git commands) is to > actually delete some content, and the initial impression of this > command is that it will delete an actual worktree. however, further > reading reveals: > > " ... or you can run git worktree prune in the main or any linked > working tree to clean up any stale administrative files." > > ah, so one learns that the subcommand "prune" does *not* do any > actual pruning as people would *normally* understand it, it simply > deletes the administrative information about an already-deleted > worktree, do i read that correctly? Yes. This usage is consistent with "git remote prune" which removes administrative information about local branches which have already been deleted on the remote side. > that's emphasized further down in the actual definition of "prune": > > prune > Prune working tree information in $GIT_DIR/worktrees. > > but perhaps that explanation could be extended to say it only works on > already-deleted trees, since that's certainly not clear from that > single sentence. As originally implemented, git-worktree would detect deleted or relocated worktrees and prune or update the administrative information automatically. So, "prune" was more a behind-the-scenes implementation detail rather than an important user-facing command. However, the implementation and semantics of that automatic behavior were not quite robust and ended up leaving things in a slightly corrupted state (if I recall correctly), though the corruption was easily corrected by hand. As a consequence, the automatic behavior was retired while the general implementation of git-worktree "cooked", with the idea that it could be revisited later, with the result that "prune" became more user-facing than originally intended. The above description could be extended with more information. An alternative would be to point the reader at the "DETAILS" section as is done already for "prune" in "DISCUSSION". > finally, the prune "--expire" option is truly confusing: > > --expire