Re: [RFC/PATCH] worktree: replace "checkout --to" with "worktree new"
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Jul 1, 2015, 10:46 UTC
- Message-ID
- <CACsJy8DaCK3Z4mfVEjkZsALdeNx9LDe=cw=m-qB39a2fmqR80g@mail.gmail.com>
- In-Reply-To
- <xmqqy4j16tqk.fsf@gitster.dls.corp.google.com>
On Tue, Jun 30, 2015 at 11:33 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 12 quoted lines
> Duy Nguyen <pclouds@gmail.com> writes: > >> I think this is like "git checkout -b" vs "git branch". We pack so >> many things in 'checkout' that it's a source of both convenience and >> confusion. I never use "git branch" to create a new branch and if I >> had a way to tell checkout to "move away and delete previous branch", >> I would probably stop using "git branch -d/-D" too. "--to" is another >> "-b" in this sense. > > I didn't know "checkout --to" included "create a worktree elsewhere > and chdir there"; if that "and chdir there" is not something you are > doing, then I do not think "checkout -b" vs "branch" analogy applies.
Heh.. I do want that "chdir" (even for git-init and git-clone). We can't issue "cd" command back to the parent shell, but we can spawn a new shell with new cwd. But because the target dir is usually at the end of the command line (except for "--to") and "cd !$" is not much to type, it never bothers me enough to do something more. I think this is another reason I prefer "git worktree add" to have the target dir at the end.
-- Duy