From: Eric Sunshine Date: Thu, 10 Mar 2016 20:45:10 GMT Subject: Re: [PATCH 0/1] Introduce a way to create a branch and worktree at the same time Message-ID: In-Reply-To: On Thu, Mar 10, 2016 at 6:51 AM, Duy Nguyen wrote: > On Thu, Mar 10, 2016 at 6:34 PM, Johannes Schindelin > wrote: >> The invention of the `git worktree` command changed this developer's >> working style dramatically. Rather than switching between branches all >> the time, topic branches are created and checked out in newly-added >> worktrees, to be reworked and refined until the topic branch is either >> merged into `master` or abandoned. >> >> It gets rather tiresome, and also typo-prone, to call "git branch xyz >> upstream/master && git worktree add xyz xyz" all the time. > > You can actually do "git worktree -b xyz xyz upstream/master" for the > same effect. Maybe we can avoid "xyz" duplication with "-b -" or a new > option name? There's also the even shorter form: git worktree add pull-rebase-prefix which creates both a branch and a worktree named "pull-rebase-prefix". This assumes that you want the new branch based upon HEAD, which won't work if your use-case is different and that you're not already at the desired commit ("origin/master" in your example) when invoking the command, though.