From: Duy Nguyen Date: Sun, 31 Aug 2014 04:49:17 GMT Subject: Re: [PATCH 22/32] checkout: support checking out into a new working directory Message-ID: In-Reply-To: <70985AC885404243A2B95F534083A0E9@PhilipOakley> On Sun, Aug 31, 2014 at 3:50 AM, Philip Oakley wrote: >> @@ -225,6 +225,13 @@ This means that you can use `git checkout -p` to >> selectively discard >> edits from your current working tree. See the ``Interactive Mode'' >> section of linkgit:git-add[1] to learn how to operate the `--patch` mode. >> >> +--to=:: >> + Check out a new branch in a separate working directory at > > > Is this actually a 'new' branch? Perhaps s/new //. More below. Only when -b is also used. Will fix. >> +All checkouts share the same repository. Linked checkouts see the >> +repository a bit different from the main checkout. When the checkout >> +"new" reads the path $GIT_DIR/HEAD for example, the actual path > > > I was caught out by "new" (in quotes) here. I see that the commit msg in > patch 24 uses 'new-branch', while in patch 30 is used. Is this "new" > (above) refering to the branch name (or detatched head), or a nmemonic for > the path? The use of "new working directory" in the previous paragraph is a > well qualified use of new, so I'm looking to ensure that it's well qualified > here. > > My immediate reaction was that a consistent use of in the three > patches may be all that's needed It's probably clearer if I start that paragraph with "git checkout --to " then "new" is replaced with "". The thing is, each checkout needs a unique id, and this id is usually the branch name to be checked out. But after worktree creation, even if the user switches branch, the id remains the same. >> +returned could be $GIT_DIR/repos/new/HEAD. This ensures checkouts > > > surely s/could/would/? or have I misunderstood? It's ../repos/new/...if the directory with the same name does not exist. If it does, a number will follow after 'new' to make it unique, e.g. ../repos/new1/... Perhaps this paragraph could be rewritten like this All checkouts share the same repository. Linked checkouts see the repository a bit different from the main checkout. When you perform the command ------------ git checkout --to ------------ The checkout at will have a unique id that is also the branch name (e.g. ""). A number may be appended to the id to make it unique. All worktree-specific files of this new checkout are in $GIT_DIR/repos/ of the main checkout. So "HEAD" inside the linked checkout will be resolved to "$GIT_DIR/repos//HEAD", while "HEAD" from the main checkout remains "$GIT_DIR/HEAD". -- Duy