Thank you for filling out a Git bug report! Please answer the following questions to help us understand your issue. What did you do before the bug happened? (Steps to reproduce your issue) Running the following two scripts. Script one: '#!/bin/bash mkdir parent git -C parent init git -C parent -c user.name="P" -c user.email="m@xxxxxxxxxxx" commit -m one --allow-empty mkdir cloneDir cd cloneDir git init git pull -v --rebase "../parent" echo git pull exit code: $?' script two: '#!/bin/bash mkdir parent git -C parent init git -C parent -c user.name="P" -c user.email="m@xxxxxxxxxxx" commit -m one --allow-empty mkdir cloneDir cd cloneDir git init git commit -m "foo" --dry-run git pull -v --rebase "../parent" echo git pull exit code: $?' What did you expect to happen? (Expected behavior) Since they only differ in the 'git commit -m "foo" --dry-run' invocation, I would expect the same outcome for both scripts. Expected output of the last two lines: 'From ../parent * branch HEAD -> FETCH_HEAD git pull exit code: 0' What happened instead? (Actual behavior) The second script is not able to pull from ../parent. Output of the last lines of the second script: 'fatal: Updating an unborn branch with changes added to the index. git pull exit code: 128’ Anything else you want to add: I tested this on git 2.35.1, 2.34.1 and 2.21.0 and they are all affected. [System Info] git version: git version 2.35.1 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh uname: Linux 5.10.25-linuxkit #1 SMP Tue Mar 23 09:27:39 UTC 2021 x86_64 compiler info: gnuc: 10.2 libc info: glibc: 2.31 $SHELL (typically, interactive shell): <unset> [Enabled Hooks] not run from a git repository - no hooks to show