Re: [PATCH v2 1/1] sequencer: fix empty commit check when amending
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 26, 2019, 01:11 UTC
- Message-ID
- <xmqqy2w3wieb.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <43bdadd2-9ea9-4e50-1f47-ec18e0db4794@gmail.com>
Phillip Wood <phillip.wood123@gmail.com> writes:
Show 11 quoted lines
>>> +test_expect_success 'fixup on orphan branch errors out' ' >>> + >>> + test_when_finished "git switch master" && >>> + write_script switch-branch.sh <<-\EOF && >>> + git symbolic-ref HEAD refs/heads/does-not-exist && >>> + git rm -rf . >> >> That "git rm -rf ." scares me, though. > > I know I'm not too keen on it my self but we need to empty the > worktree and index if we're going to switch to an unborn branch
"checkout --orphan" takes you to an unborn branch. If you need to also be with no contents in the index and nothing in the working tree, then "git rm -r ." may be needed, but applying a fixup without the target content does sound like asking for a conflict already.