git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Smith <paul@mad-scientist.net>
To: Yichao Yu <yyc1992@gmail.com>, git <git@vger.kernel.org>
Subject: Re: Minor missing features in worktree compare to new-workdir
Date: Wed, 14 Jun 2017 08:41:29 -0400	[thread overview]
Message-ID: <1497444089.13409.108.camel@mad-scientist.net> (raw)
In-Reply-To: <CAMvDr+Qxjdgnm0aW3WenDpFs2NBhyrNXZA2M7sjsCjJs+RzM3Q@mail.gmail.com>

On Wed, 2017-06-14 at 08:31 -0400, Yichao Yu wrote:
> 1. the branch name in new-workdir has the same behavior as checkout,
> i.e. when it matches a remote branch name a local branch tracking that
> remote branch will be created and checked out. worktree gives an error
> in this case. This is very useful for fetching someone else' feature
> branch into a different work dir for testing.

I agree; this behavior of worktree is frustrating.  It's a very common
use-case to aid in code reviews etc. and it's not easy to explain to
people what they need to do to make this work.

> 2. worktree doesn't seem to support multiple worktree on the same
> branch.

I think this is a very good thing about worktrees as opposed to
workdirs.

In a situation where I may want multiple worktrees pointing to the same
commit I just check out the SHA rather than the branch: you can have as
many branches set to the same SHA (detached HEAD) as you like, and
there's no concern about dirty workspaces.  This latter can actually be
a really big problem (suppose the workdir contained some modified files
then you update another workdir with the same branch... it's not easy to
figure out what happened here!)

  reply	other threads:[~2017-06-14 12:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-14 12:31 Minor missing features in worktree compare to new-workdir Yichao Yu
2017-06-14 12:41 ` Paul Smith [this message]
2017-06-15  0:40   ` Yichao Yu

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

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

  git send-email \
    --in-reply-to=1497444089.13409.108.camel@mad-scientist.net \
    --to=paul@mad-scientist.net \
    --cc=git@vger.kernel.org \
    --cc=yyc1992@gmail.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).