Phillip Wood <phillip.wood123@xxxxxxxxx> 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.