]> git.ipfire.org Git - thirdparty/git.git/commit
git-worktree.txt: discuss branch-based vs. throwaway worktrees
authorEric Sunshine <sunshine@sunshineco.com>
Mon, 7 Sep 2020 00:02:22 +0000 (20:02 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 Sep 2020 01:53:56 +0000 (18:53 -0700)
commitdccadad736c801e924c7c14e8c6bd1a6e15e70e5
treeb34945bd4ffe0a691f8781812b3c60a340de80f1
parentc670aa47dff9829360cc69174f8dd0d82f096011
git-worktree.txt: discuss branch-based vs. throwaway worktrees

By default, `git worktree add` creates a new worktree associated with a
particular branch (which may have been created automatically if not
specified explicitly on the command-line). It is also convenient to
create throwaway worktrees not associated with any branch, which can be
handy when making experimental changes or doing testing. However, the
latter use-case may not be obvious to newcomers since the high-level
description of worktrees talks only about checking out "more than one
branch at a time". Therefore, enhance the description to to discuss both
use-cases.

A secondary goal of highlighting the distinction between branch-based
and throwaway worktrees is to help newcomers understand that the
simplest form `git worktree add <path>` automatically creates a new
branch. Stating this early in the description, may help newcomers avoid
creating branches without realizing they are doing so, and later
wondering why `git branch --list` shows branches the user did not
intentionally create.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-worktree.txt