Merge branch 'ms/doc-worktree-side-by-side' into seen

Document "git worktree add" and use of out-of-tree worktrees with
examples.

* ms/doc-worktree-side-by-side:
  doc: git-worktree: Add side by side branch checkout example
  doc: git-worktree: Link to examples
This commit is contained in:
Junio C Hamano
2025-12-12 22:11:52 +09:00

View File

@@ -79,6 +79,9 @@ with a matching name, treat as equivalent to:
$ git worktree add --track -b <branch> <path> <remote>/<branch>
------------
+
For best results it is advised to specify _<path>_ outside of the repository
and existing worktrees - see <<EXAMPLES,EXAMPLES>>
+
If the branch exists in multiple remotes and one of them is named by
the `checkout.defaultRemote` configuration variable, we'll use that
one for the purposes of disambiguation, even if the _<branch>_ isn't
@@ -502,6 +505,7 @@ locked "reason\nwhy is locked"
...
------------
[[EXAMPLES]]
EXAMPLES
--------
You are in the middle of a refactoring session and your boss comes in and
@@ -522,6 +526,16 @@ $ popd
$ git worktree remove ../temp
------------
Side by side branch checkouts for a repository using multiple worktrees
------------
mkdir some-repository
cd some-repository
git clone --bare gitforge@someforge.example.com:some-org/some-repository some-repository.git
git --git-dir=some-repository.git worktree add some-branch
git --git-dir=some-repository.git worktree add another-branch
------------
CONFIGURATION
-------------