git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: git@vger.kernel.org
Cc: "Pratyush Yadav" <me@yadavpratyush.com>,
	"SZEDER Gábor" <szeder.dev@gmail.com>,
	"Junio C Hamano" <gitster@pobox.com>,
	"Eric Sunshine" <sunshine@sunshineco.com>
Subject: [PATCH v2 0/3] worktree: teach `add` -d for --detach & improve documentation
Date: Sun,  6 Sep 2020 20:02:19 -0400	[thread overview]
Message-ID: <20200907000222.4717-1-sunshine@sunshineco.com> (raw)
In-Reply-To: <20200904070703.47898-1-sunshine@sunshineco.com>

This is a re-roll of [1] which brings `git worktree add` in line with
the other "checkout a branch" commands `git switch` and `git checkout`
by teaching it -d as shorthand for --detach (which those other commands
already understand). It also enhances `git worktree` documentation to
emphasize that `git worktree add <path>` creates a new branch by
default, and to discuss branch-based vs. throwaway worktrees, which may
help newcomers avoid creating branches without realizing they are doing
so, and later wondering why `git branch --list` shows branches they did
not intentionally create.

v2 adjusts the commit message of [2/3] to make it clearer[2] that it
teaches `git worktree add` (not `git worktree`, in general) to
recognized -d as shorthand for --detach.

[1]: https://lore.kernel.org/git/20200904070703.47898-1-sunshine@sunshineco.com/T/
[2]: https://lore.kernel.org/git/xmqqlfhm36v2.fsf@gitster.c.googlers.com/

Eric Sunshine (3):
  git-checkout.txt: document -d short option for --detach
  worktree: teach `add` to recognize -d as shorthand for --detach
  git-worktree.txt: discuss branch-based vs. throwaway worktrees

 Documentation/git-checkout.txt |  1 +
 Documentation/git-worktree.txt | 13 +++++++++++++
 builtin/worktree.c             |  2 +-
 3 files changed, 15 insertions(+), 1 deletion(-)

Range-diff against v1:
1:  61ac1d5e14 ! 1:  538aaaf72d git-checkout.txt: document -d short option for --detach
    @@ Metadata
      ## Commit message ##
         git-checkout.txt: document -d short option for --detach
     
    -    git-checkout learned -d as short option for --detach in 163e3b2975
    +    `git checkout` learned -d as short option for --detach in 163e3b2975
         (switch: add short option for --detach, 2019-03-29) but the
         documentation was never updated to reflect the change.
     
2:  4f43ff6ddc ! 2:  49b3b3795d worktree: add -d short option for --detach
    @@ Metadata
     Author: Eric Sunshine <sunshine@sunshineco.com>
     
      ## Commit message ##
    -    worktree: add -d short option for --detach
    +    worktree: teach `add` to recognize -d as shorthand for --detach
     
    -    Like git-switch and git-checkout, git-worktree can check out a branch or
    -    set up a detached HEAD. However, unlike git-switch and git-checkout,
    -    git-worktree does not understand -d as shorthand for --detach, which may
    -    confound users accustomed to using -d for this purpose. Address this
    -    shortcoming by adding -d as shorthand for --detach in order to bring
    -    git-worktree in line with the other commands.
    +    Like `git switch` and `git checkout`, `git worktree add` can check out a
    +    branch or set up a detached HEAD. However, unlike those other commands,
    +    `git worktree add` does not understand -d as shorthand for --detach,
    +    which may confound users accustomed to using -d for this purpose.
    +    Address this shortcoming by teaching `add` to recognize -d for --detach,
    +    thus bringing it in line with the other commands.
     
         Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
     
3:  628a7b7bb0 ! 3:  e5de1aaf18 git-worktree.txt: discuss branch-based vs. throwaway worktrees
    @@ Metadata
      ## Commit message ##
         git-worktree.txt: discuss branch-based vs. throwaway worktrees
     
    -    By default, "git worktree add" creates a new worktree associated with a
    +    By default, `git worktree add` creates a new worktree associated with a
         particular branch (which may have been created automatically if not
         specified explicitly on the command-line). It is also convenient to
         create throwaway worktrees not associated with any branch, which can be
    @@ Commit message
         and throwaway worktrees is to help newcomers understand that the
         simplest form `git worktree add <path>` automatically creates a new
         branch. Stating this early in the description, may help newcomers avoid
    -    creating unwanted new branches without being aware that they are doing
    -    so, and later wondering why `git branch --list` shows branches the user
    -    did not intentionally create.
    +    creating branches without realizing they are doing so, and later
    +    wondering why `git branch --list` shows branches the user did not
    +    intentionally create.
     
         Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
     
-- 
2.28.0.618.gf4bc123cb7


  parent reply	other threads:[~2020-09-07  0:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-04  7:07 [PATCH 0/3] worktree: add -d shorthand " Eric Sunshine
2020-09-04  7:07 ` [PATCH 1/3] git-checkout.txt: document -d short option for --detach Eric Sunshine
2020-09-04  7:07 ` [PATCH 2/3] worktree: add " Eric Sunshine
2020-09-04  7:07 ` [PATCH 3/3] git-worktree.txt: discuss branch-based vs. throwaway worktrees Eric Sunshine
2020-09-06 21:58 ` [PATCH 0/3] worktree: add -d shorthand for --detach & improve documentation Junio C Hamano
2020-09-07  0:02 ` Eric Sunshine [this message]
2020-09-07  0:02   ` [PATCH v2 1/3] git-checkout.txt: document -d short option for --detach Eric Sunshine
2020-09-07  0:02   ` [PATCH v2 2/3] worktree: teach `add` to recognize -d as shorthand " Eric Sunshine
2020-09-07  0:02   ` [PATCH v2 3/3] git-worktree.txt: discuss branch-based vs. throwaway worktrees Eric Sunshine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200907000222.4717-1-sunshine@sunshineco.com \
    --to=sunshine@sunshineco.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=me@yadavpratyush.com \
    --cc=szeder.dev@gmail.com \
    --subject='Re: [PATCH v2 0/3] worktree: teach `add` -d for --detach & improve documentation' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).