From: Kiesel, Norbert Date: Mon, 08 Jun 2026 16:12:44 GMT Subject: Re: [PATCH] worktree: record creation time and free-form note Message-ID: In-Reply-To: Hi team, I updated my proposed extension in a couple of ways you suggested, and also added some more test code. Best, Norbert diff --git Documentation/git-worktree.adoc Documentation/git-worktree.adoc index fbf8426cd9..1cdbdc8dbe 100644 --- Documentation/git-worktree.adoc +++ Documentation/git-worktree.adoc @@ -10,8 +10,11 @@ SYNOPSIS -------- [synopsis] git worktree add [-f] [--detach] [--checkout] [--lock [--reason ]] + [--description ] [--orphan] [(-b | -B) ] [] -git worktree list [-v | --porcelain [-z]] +git worktree describe [] +git worktree list [-v | --porcelain [-z]] [--show-created] + [--show-updated] [--show-description] [--sort=] git worktree lock [--reason ] git worktree move git worktree prune [-n] [-v] [--expire ] @@ -106,6 +109,16 @@ passed to the command. In the event the repository has a remote and command fails with a warning reminding the user to fetch from their remote first (or override by using `-f`/`--force`). +`describe []`:: + +Set, replace, or clear a free-form description on a linked worktree. +Useful for recording what a worktree was created for so it can be identified +later. With __, the worktree's description is set or replaced; +without a description argument, the existing description is cleared. The +description for a worktree may also be set at creation time with +`git worktree add --description `. The main worktree cannot be +described. + `list`:: List details of each worktree. The main worktree is listed first, @@ -114,6 +127,28 @@ whether the worktree is bare, the revision currently checked out, the branch currently checked out (or "detached HEAD" if none), "locked" if the worktree is locked, "prunable" if the worktree can be pruned by the `prune` command. ++ +Each worktree's creation timestamp is recorded when it is created with +`git worktree add`. Worktrees created before this feature existed have no +recorded creation timestamp; for them, `list` reports `created: unknown` +in human output and omits the `created` line in `--porcelain` output. Pass +`--show-created` to include creation timestamps in human output. Worktrees +without a recorded timestamp sort last (or first when reversed) with +`--sort=created`. ++ +Pass `--show-updated` to include each worktree's last-updated timestamp, +which is the modification time of the worktree's `HEAD` file and so +reflects checkouts, commits, resets, rebases, and similar Git operations. ++ +Pass `--show-description` to include any user-provided description in human +output. In `--porcelain` output, the `created`, `updated`, and +`description` lines are emitted whenever the underlying data is available. ++ +Use `--sort=` (where __ is `path`, `created`, or `updated`, +optionally prefixed with `-` to reverse) to order the linked worktrees; +the main worktree always remains first. Sorting by `created` or `updated` +implies the matching `--show-created` / `--show-updated` flag so the order +is visible alongside the data. `lock`:: @@ -286,6 +321,46 @@ _