diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-11-08 10:33:19 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-11-08 10:33:19 -0800 |
| commit | 937cdc2e52bed6f827bfcd5ce5d5dc7fd89f9197 (patch) | |
| tree | 6fe557297aa59a08a20b543e250d46822f6e46b7 | |
| parent | Merge branch 'ar/submodule-gitdir-tweak' into seen (diff) | |
| parent | doc: git-worktree: Add side by side branch checkout example (diff) | |
| download | git-937cdc2e52bed6f827bfcd5ce5d5dc7fd89f9197.tar.gz git-937cdc2e52bed6f827bfcd5ce5d5dc7fd89f9197.zip | |
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
| -rw-r--r-- | Documentation/git-worktree.adoc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Documentation/git-worktree.adoc b/Documentation/git-worktree.adoc index f272f79783..0f82ec5439 100644 --- a/Documentation/git-worktree.adoc +++ b/Documentation/git-worktree.adoc @@ -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 ------------- |
