On 01/09/2024 12:02, Han Jiang wrote:
What did you do before the bug happened? (Steps to reproduce your issue)
git -C './client/repo' -c 'core.editor=cat' rebase
--onto=HEAD@{upstream} --interactive "$(git -C './client/repo'
merge-base --fork-point HEAD@{upstream} HEAD)" HEAD
"git rebase <upstream> <branch>" is designed to switch to a different
branch before rebasing it. If you do not want to switch branches you
should use "git rebase <upstream>". "<branch>" is expected to be a
branch name, not a symbolic ref to the branch like "HEAD".
Replacing `HEAD` with branch name (`"$(git -C './client/repo' branch
--show-current)"`) works around the problem.
This is working as expected.
"git checkout HEAD" is a no-op so "git rebase <upstream> HEAD" is
behaving differently to "git checkout HEAD && git rebase <upstream>". We
could look at changing that but it would be a breaking change for anyone
relying on the current behavior to detach HEAD before rebasing.
Best Wishes
Phillip