Subject: [PATCH 0/4] worktree: Support `--orphan` when creating new worktrees

From: Jacob Abel <[email-masked]>
Date: Fri, 04 Nov 2022 01:02:53 +0000

While working with the worktree based git workflow, I realised that setting
up a new git repository required switching between the traditional and
worktree based workflows. Searching online I found a SO answer [1] which
seemed to support this and which indicated that adding support for this should
not be technically difficult.

Note: This is my first patchset for git so please let me know if there's anything
I should do differently to improve contributions in the future.

This patchset has three parts:

  * adding `-B` to the usage docs (noticed during dev and it seemed too small
    to justify a separate submission)
  * switching from `git reset --hard` to `git checkout` for worktree checkout
  * adding orphan branch functionality (as is present in `git-checkout`)
    to `git-worktree-add`

1. https://stackoverflow.com/a/68717229/15064705

Jacob Abel (4):
  worktree add: Include -B in usage docs
  builtin/worktree.c: Update checkout_worktree() to use git-worktree
  worktree add: add --orphan flag
  worktree add: Add unit tests for --orphan

 Documentation/git-worktree.txt | 18 ++++++++-
 builtin/worktree.c             | 72 +++++++++++++++++++++++++---------
 t/t2400-worktree-add.sh        | 54 +++++++++++++++++++++++++
 3 files changed, 124 insertions(+), 20 deletions(-)

base-commit: c03801e19cb8ab36e9c0d17ff3d5e0c3b0f24193
--
2.37.4