From: Junio C Hamano Date: Tue, 26 Nov 2019 01:11:56 GMT Subject: Re: [PATCH v2 1/1] sequencer: fix empty commit check when amending Message-ID: In-Reply-To: <43bdadd2-9ea9-4e50-1f47-ec18e0db4794@gmail.com> Phillip Wood writes: >>> +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.