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 via email to