It was reported by Nazri Ramliy that ORIG_HEAD was set incorrectly again, this time caused by the shortcut to call git am directly, without detouring to a Unix shell script. Patch 2/4 might look like something completely unrelated, but without it, the update to HEAD might use an incorrect reflog message. Patch 1/4 is more a "while at it" patch; while looking which code paths might need to update ORIG_HEAD, I noticed that this reset_head() call did unnecessary work. Johannes Schindelin (4): built-in rebase: no need to check out `onto` twice built-in rebase: use the correct reflog when switching branches built-in rebase: demonstrate that ORIG_HEAD is not set correctly built-in rebase: set ORIG_HEAD just once, before the rebase builtin/rebase.c | 37 +++++++++++++++++++++---------------- t/t3400-rebase.sh | 8 ++++++++ 2 files changed, 29 insertions(+), 16 deletions(-) base-commit: 21853626eac565dd42572d90724b29863f61eb3b Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-153%2Fdscho%2Frebase-am-and-orig-head-v1 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-153/dscho/rebase-am-and-orig-head-v1 Pull-Request: https://github.com/gitgitgadget/git/pull/153 -- gitgitgadget