From 670e369b05e48f82c1877346ad7331385986aaf9 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Mon, 13 Apr 2026 08:13:43 -0700 Subject: [PATCH] Rebase remaining commits on top of exported stack after partial export After exporting a sub-range of a branch (e.g. -H transforms~8 while on transforms), the commits beyond the export head are replayed onto the amended stack tip using --onto so that only the genuinely remaining commits are replayed, not the already-exported ones. Assisted-by: Claude Code Co-Authored-By: Claude Sonnet 4.6 --- src/stack_pr/cli.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/stack_pr/cli.py b/src/stack_pr/cli.py index 3714406..5dee085 100755 --- a/src/stack_pr/cli.py +++ b/src/stack_pr/cli.py @@ -841,6 +841,7 @@ def command_submit( # If the current branch contains commits from the stack, we will need to # rebase it in the end since the commits will be modified. top_branch = st[-1].head + orig_head_commit = st[-1].commit.commit_id() need_to_rebase_current = is_ancestor(top_branch, current_branch) # Push local branches to remote @@ -878,7 +879,9 @@ def command_submit( [ "git", "rebase", + "--onto", top_branch, + orig_head_commit, current_branch, "--committer-date-is-author-date", ]