gh-stack icon indicating copy to clipboard operation
gh-stack copied to clipboard

`gh stack rebase -i` - allow interactive rebasing

Open wmcnamee-coreweave opened this issue 5 months ago • 2 comments

Support -i for rebasing stacks.

I ❤️ rebasing, and doing no-edit amends. When I do that in a branch low in the stack, the higher layers end up with "duplicate-ish" commits that conflict. The solution during a normal rebase is to drop that new duplicate. Here's an example

Initial State

branch-a main -> commitA (111aaa)

branch-b main -> commitA (111aaa) -> commitB (222bbb)

Change in branch-a and git commit --amend'd

if I go to branch-a and make a change using git commit --amend I'll end up with this:

branch-a main -> commitA (112aaa)

branch-b main -> commitA (111aaa) -> commitB (222bbb)

Finally, rebasing branch-b

Then when branch-b gets rebased, it looks like this:

main -> commitA (112aaa) -> commitA (111aaa) -> commitB (222bbb)

Again, the solution is simply to drop commitA (111aaa), as that's the old one.

But I can't do that with gh stack rebase.

wmcnamee-coreweave avatar Jun 28 '26 05:06 wmcnamee-coreweave

Another 0.0.7 reproduction:

  1. Create main <- A <- B.
  2. Rewrite A, leaving B based on the old A SHA.
  3. From B, run gh stack rebase --no-trunk.

The rebase starts replaying the old A commit onto rewritten A and conflicts before reaching B. Expected: replay only B's unique commits.

windsornguyen avatar Jul 13 '26 21:07 windsornguyen

Congratulations on officially becoming public preview! 🥳

I re-tested on July 30, 2026 with gh-stack v0.1.0 and can verify that the amended-parent correctness case is fixed! 🎉

Exact reproduction: main <- A <- B, amend A, then run gh stack rebase --no-trunk from B. The result was main -> rewritten A -> B. The old A was not an ancestor, only two stack commits remained, and no conflict occurred. Hooray!

The interactive-rebase feature request remains separate; however, the duplicate-parent replay described above is fixed. 🙏

This issue should now be closed.

windsornguyen avatar Jul 30 '26 18:07 windsornguyen