From: Michael Rappazzo Date: Fri, 18 Sep 2015 13:30:27 GMT Subject: [PATCH v8 4/4] worktree: add 'list' command Message-ID: <1442583027-47653-5-git-send-email-rappazzo@gmail.com> In-Reply-To: <1442583027-47653-1-git-send-email-rappazzo@gmail.com> 'git worktree list' iterates through the worktree list, and outputs details of the worktree including the path to the worktree, the currently checked out revision and branch, and if the work tree is bare. There is also porcelain format option available. Signed-off-by: Michael Rappazzo --- Documentation/git-worktree.txt | 15 +++++++- builtin/worktree.c | 78 ++++++++++++++++++++++++++++++++++++++ t/t2027-worktree-list.sh | 86 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 178 insertions(+), 1 deletion(-) create mode 100755 t/t2027-worktree-list.sh diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt index fb68156..8ee65c6 100644 --- a/Documentation/git-worktree.txt +++ b/Documentation/git-worktree.txt @@ -11,6 +11,7 @@ SYNOPSIS [verse] 'git worktree add' [-f] [--detach] [-b ] [] 'git worktree prune' [-n] [-v] [--expire ] +'git worktree list' [--porcelain] DESCRIPTION ----------- @@ -59,6 +60,13 @@ prune:: Prune working tree information in $GIT_DIR/worktrees. +list:: + +List details of each worktree. The main worktree is listed first, followed by +each of the linked worktrees. The output details include if the worktree is +bare, the revision currently checked out, and the branch currently checked out +(or 'detached HEAD' if none). + OPTIONS ------- @@ -86,6 +94,11 @@ OPTIONS With `prune`, do not remove anything; just report what it would remove. +--porcelain:: + With `list`, output in an easy-to-parse format for scripts. + This format will remain stable across Git versions and regardless of user + configuration. + -v:: --verbose:: With `prune`, report all removals. @@ -93,6 +106,7 @@ OPTIONS --expire