diff options
author | Jacob Abel <jacobabel@nullpo.dev> | 2023-05-17 23:48:47 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-05-18 00:55:24 +0200 |
commit | 7ab891898524abbeb2c52f3f55fcf5e2457f930b (patch) | |
tree | 6f5870dfadb35db3d1cd8225f6b765217572c0a8 /patch-delta.c | |
parent | t2400: add tests to verify --quiet (diff) | |
download | git-7ab891898524abbeb2c52f3f55fcf5e2457f930b.tar.xz git-7ab891898524abbeb2c52f3f55fcf5e2457f930b.zip |
worktree add: add --orphan flag
Add support for creating an orphan branch when adding a new worktree.
The functionality of this flag is equivalent to git switch's --orphan
option.
Current Behavior:
% git -C foo.git --no-pager branch -l
+ main
% git -C foo.git worktree add main/
Preparing worktree (new branch 'main')
HEAD is now at 6c93a75 a commit
%
% git init bar.git
Initialized empty Git repository in /path/to/bar.git/
% git -C bar.git --no-pager branch -l
% git -C bar.git worktree add main/
Preparing worktree (new branch 'main')
fatal: not a valid object name: 'HEAD'
%
New Behavior:
% git -C foo.git --no-pager branch -l
+ main
% git -C foo.git worktree add main/
Preparing worktree (new branch 'main')
HEAD is now at 6c93a75 a commit
%
% git init --bare bar.git
Initialized empty Git repository in /path/to/bar.git/
% git -C bar.git --no-pager branch -l
% git -C bar.git worktree add main/
Preparing worktree (new branch 'main')
fatal: invalid reference: HEAD
% git -C bar.git worktree add --orphan -b main/
Preparing worktree (new branch 'main')
% git -C bar.git worktree add --orphan -b newbranch worktreedir/
Preparing worktree (new branch 'newbranch')
%
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Jacob Abel <jacobabel@nullpo.dev>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'patch-delta.c')
0 files changed, 0 insertions, 0 deletions