{"thread":{"id":"65784","subject":"[BUG] rebase --update-refs emits unqualified \"update-ref HEAD\" into the todo","startedAt":"2026-06-10T11:01:16Z","lastAt":"2026-06-10T15:39:26Z","messageCount":2,"participants":["betel_taxis4h@icloud.com","Phillip Wood"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"545128","messageId":"35A368B8-9B8A-44A9-96DA-65ED16D7D564@icloud.com","threadId":"65784","inReplyTo":null,"subject":"[BUG] rebase --update-refs emits unqualified \"update-ref HEAD\" into the todo","fromName":"","fromEmail":"betel_taxis4h@icloud.com","sentAt":"2026-06-10T11:00:54Z","receivedAt":"2026-06-10T11:01:16Z","isPatch":false,"body":"What did you do before the bug happened? (Steps to reproduce your issue)\n\nWith rebase.updateRefs=true, an interactive rebase of the checked-out branch generates a todo containing the literal line \"update-ref HEAD”, which git's own todo parser then rejects.\n\nMinimal reproduction (plain repo, no worktrees, no remotes required):\n\n  git init -b main repro && cd repro\n  git -c user.email=t@t.t -c user.name=t commit --allow-empty -m base\n  git checkout -b feat\n  git -c user.email=t@t.t -c user.name=t commit --allow-empty -m c1\n  git -c user.email=t@t.t -c user.name=t commit --allow-empty -m c2\n  git -c rebase.updateRefs=true rebase -i feat~2\n\nThe generated todo contains:\n\n  pick <c1> c1\n  pick <c2> c2\n  update-ref HEAD                <-- emitted for HEAD, a symref to the branch being rebased\n  update-ref refs/heads/feat     (correctly placed; this one is fine)\n\nLetting the editor save the auto-generated todo verbatim (or running `git rebase --continue`) fails immediately with:\n\n  error: update-ref requires a fully qualified refname e.g. refs/heads/HEAD\n  error: invalid line 3: update-ref HEAD\n  You can fix this with 'git rebase --edit-todo' and then run 'git rebase --continue'.\n\nWhat did you expect to happen? (Expected behavior)\n\n--update-refs should not emit an \"update-ref HEAD\" line. HEAD is a symbolic alias of the branch being rebased; the branch ref itself is (correctly) excluded from the update-ref set, so its HEAD alias should be excluded too. The todo should contain only fully-qualified refs/heads/... lines.\n\nWhat happened instead? (Actual behavior)\n\ngit emits a todo line (\"update-ref HEAD\") that its own sequencer parser rejects as not fully qualified, breaking the rebase. The only recovery is `git rebase --edit-todo` to manually delete the line.\n\nWhat's different between what you expected and what actually happened?\n\ngit generated a todo command it refuses to execute. The unqualified \"HEAD\" should either be expanded to its target ref or omitted entirely.\n\nAnything else you want to add:\n\n- Reproduces identically in a plain single-worktree repo and in a bare-repo + linked-worktree layout, so it is not worktree-specific.\n- An in-sync remote-tracking ref (origin/feat) on the tip adds a second, valid \"update-ref refs/remotes/origin/feat\" line but is not required to trigger the fatal \"update-ref HEAD\".\n- Workaround: unset rebase.updateRefs (or pass -c rebase.updateRefs=false), or delete the \"update-ref HEAD\" line via `git rebase --edit-todo`.\n\n\n[System Info]\ngit version:\ngit version 2.54.0\ncpu: aarch64\nno commit associated with this build\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nrust: disabled\ngettext: enabled\nlibcurl: 8.14.1\nOpenSSL: OpenSSL 3.5.6 7 Apr 2026\nzlib: 1.3.1\nSHA-1: SHA1_DC\nSHA-256: SHA256_BLK\ndefault-ref-format: files\ndefault-hash: sha1\nuname: Linux 7.0.11-orbstack-00360-gc9bc4d96ac70 #1 SMP PREEMPT Thu Jun  4 16:40:25 UTC 2026 aarch64\ncompiler info: gnuc: 14.2\nlibc info: glibc: 2.41\n$SHELL (typically, interactive shell): /usr/bin/zsh\n\n"},{"id":"545166","messageId":"c9918880-31f8-42a2-83a2-8175dbffd07d@gmail.com","threadId":"65784","inReplyTo":"35A368B8-9B8A-44A9-96DA-65ED16D7D564@icloud.com","subject":"Re: [BUG] rebase --update-refs emits unqualified \"update-ref HEAD\" into the todo","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2026-06-10T15:39:19Z","receivedAt":"2026-06-10T15:39:26Z","isPatch":false,"body":"On 10/06/2026 12:00, betel_taxis4h@icloud.com wrote:\n> What did you do before the bug happened? (Steps to reproduce your issue)\n> \n> With rebase.updateRefs=true, an interactive rebase of the checked-out branch generates a todo containing the literal line \"update-ref HEAD”, which git's own todo parser then rejects.\n> \n> Minimal reproduction (plain repo, no worktrees, no remotes required):\n> \n>    git init -b main repro && cd repro\n>    git -c user.email=t@t.t -c user.name=t commit --allow-empty -m base\n>    git checkout -b feat\n>    git -c user.email=t@t.t -c user.name=t commit --allow-empty -m c1\n>    git -c user.email=t@t.t -c user.name=t commit --allow-empty -m c2\n>    git -c rebase.updateRefs=true rebase -i feat~2\n> \n> The generated todo contains:\n> \n>    pick <c1> c1\n>    pick <c2> c2\n>    update-ref HEAD                <-- emitted for HEAD, a symref to the branch being rebased\n>    update-ref refs/heads/feat     (correctly placed; this one is fine)\n\nI'm unable to reproduce this with the script above and I do not see any \nupdate-ref commands added to the todo list (which is expected as feat is \nbeing rebased so should not appear in the todo list). Do you have \nrebase.instructionFormat set? We recently had a bug report and fix[1] \nfor \"update-ref HEAD\" being added when rebase.instructionFormat includes \n\"%d\".\n\nThanks\n\nPhillip\n\n[1] https://lore.kernel.org/git/20260510224111.64467-1-mail@abhinavg.net/\n\n> Letting the editor save the auto-generated todo verbatim (or running `git rebase --continue`) fails immediately with:\n> \n>    error: update-ref requires a fully qualified refname e.g. refs/heads/HEAD\n>    error: invalid line 3: update-ref HEAD\n>    You can fix this with 'git rebase --edit-todo' and then run 'git rebase --continue'.\n> \n> What did you expect to happen? (Expected behavior)\n> \n> --update-refs should not emit an \"update-ref HEAD\" line. HEAD is a symbolic alias of the branch being rebased; the branch ref itself is (correctly) excluded from the update-ref set, so its HEAD alias should be excluded too. The todo should contain only fully-qualified refs/heads/... lines.\n> \n> What happened instead? (Actual behavior)\n> \n> git emits a todo line (\"update-ref HEAD\") that its own sequencer parser rejects as not fully qualified, breaking the rebase. The only recovery is `git rebase --edit-todo` to manually delete the line.\n> \n> What's different between what you expected and what actually happened?\n> \n> git generated a todo command it refuses to execute. The unqualified \"HEAD\" should either be expanded to its target ref or omitted entirely.\n> \n> Anything else you want to add:\n> \n> - Reproduces identically in a plain single-worktree repo and in a bare-repo + linked-worktree layout, so it is not worktree-specific.\n> - An in-sync remote-tracking ref (origin/feat) on the tip adds a second, valid \"update-ref refs/remotes/origin/feat\" line but is not required to trigger the fatal \"update-ref HEAD\".\n> - Workaround: unset rebase.updateRefs (or pass -c rebase.updateRefs=false), or delete the \"update-ref HEAD\" line via `git rebase --edit-todo`.\n> \n> \n> [System Info]\n> git version:\n> git version 2.54.0\n> cpu: aarch64\n> no commit associated with this build\n> sizeof-long: 8\n> sizeof-size_t: 8\n> shell-path: /bin/sh\n> rust: disabled\n> gettext: enabled\n> libcurl: 8.14.1\n> OpenSSL: OpenSSL 3.5.6 7 Apr 2026\n> zlib: 1.3.1\n> SHA-1: SHA1_DC\n> SHA-256: SHA256_BLK\n> default-ref-format: files\n> default-hash: sha1\n> uname: Linux 7.0.11-orbstack-00360-gc9bc4d96ac70 #1 SMP PREEMPT Thu Jun  4 16:40:25 UTC 2026 aarch64\n> compiler info: gnuc: 14.2\n> libc info: glibc: 2.41\n> $SHELL (typically, interactive shell): /usr/bin/zsh\n> \n> \n\n"}]}