Re: [PATCH v2 21/23] worktree: add: make -b/-B default to HEAD when <branch> is omitted
Eric Sunshine <sunshine@sunshineco.com> writes:
Show 20 quoted lines
> As a convenience, like "git branch" and "git checkout -b", make
> "git worktree add -b <newbranch> <path> <branch>" default to HEAD when
> <branch> is omitted.
>
> Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
> ---
> Documentation/git-worktree.txt | 1 +
> builtin/worktree.c | 6 ++++--
> t/t2025-worktree-add.sh | 7 +++++++
> 3 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt
> index f6c3747..5ca11f6 100644
> --- a/Documentation/git-worktree.txt
> +++ b/Documentation/git-worktree.txt
> @@ -69,6 +69,7 @@ OPTIONS
> -B <new-branch>::
> With `add`, create a new branch named `<new-branch>` starting at
> `<branch>`, and check out `<new-branch>` into the new worktree.
> + If `<branch>` is omitted, it defaults to HEAD.
What would be the SYNOPSIS change to adjust for this, I wonder.
'git worktree add' [-f] [--detach] [-b <new-branch>] <path> [<branch>]
or something? Can I omit <branch> without giving -b <new-branch>?