Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

gh stack rebase replays the same child commit twice on v0.1.1

未关闭
#495 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
52/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
git, go
领域
cli, tooling

调研方向

gh stack rebase 命令开始,在 Windows 或 PowerShell 上复现 issue 中描述的三层 stack。检查 stack3/02-service 的级联 rebase 状态,包括 .git/rebase-merge/donegit rebase --edit-todo。完成的标准是每一层自己的 commit 范围都恰好被重放一次,并且 API 层成功 rebase 到更新后的 service 层之上。

由索引模型根据 Issue 内容生成。

描述

Summary

gh stack rebase appears to replay the same child commit twice when a lower
branch in a stack receives a new commit.

This reproduces consistently for me with gh stack v0.1.1 on a freshly
created stack.

This looks similar to #250, but I am reproducing it on v0.1.1, which includes
the fix for amended parent commits being replayed into child branches.

Environment

  • OS: Windows
  • Shell: PowerShell
  • gh stack version: 0.1.1
  • Stack trunk: main

Stack

I created a simple three-layer stack:

main
  └─ stack3/01-model
       └─ stack3/02-service
            └─ stack3/03-api

Each layer initially has one commit:

  • stack3/01-model: Add Product model
  • stack3/02-service: Add Product Service
  • stack3/03-api: Add Product API

I then added another commit to the bottom layer (stack3/01-model).

Conceptually:

main
  └─ Add Product model
       └─ Add price to Product model
            └─ [Product Service should be rebased here]
                 └─ [Product API should be rebased here]

Reproduction

After adding the new commit to stack3/01-model, I ran:

gh stack rebase

Output:

Fetched latest main from origin
Trunk main is already up to date
Stack detected: (main) <- stack3/01-model <- stack3/02-service <- stack3/03-api
Rebasing branches in order, starting from stack3/01-model to stack3/03-api
Rebased stack3/01-model onto main

The command then stops while rebasing stack3/02-service.

From another terminal:

git status

reports:

interactive rebase in progress; onto 9c2c2c2

Last command done (1 command done):
   pick 96bd07c # Add Product Service

Next command to do (1 remaining command):
   pick 96bd07c # Add Product Service

You are currently rebasing branch 'stack3/02-service' on '9c2c2c2'.
(all conflicts fixed: run "git rebase --continue")

Changes to be committed:
    new file: src/product-service.js

I inspected the rebase state.

git rebase --edit-todo contains:

pick 96bd07c # Add Product Service

And:

Get-Content .git\rebase-merge\done

contains:

pick 96bd07c... # Add Product Service

Therefore the same commit (96bd07c) appears to have already been processed
and is also still present as the next commit in the rebase todo.

Actual behavior

The cascade rebase gets stuck while rebasing the second layer.

The same Add Product Service commit appears as both:

  • the last completed rebase command, and
  • the next remaining rebase command.

src/product-service.js is already staged from the first application.

Expected behavior

Each layer's own commit range should be replayed exactly once onto the newly
rebased parent.

Conceptually, after changing the bottom layer:

main
  └─ model
       └─ model-update
            └─ service'
                 └─ api'

The service commit should be replayed once onto the new 01-model head, and
the API commit should then be replayed once onto the new 02-service head.

Additional notes

I previously encountered a similar failure with another stack. To rule out
corrupted state from that experiment, I created stack3 from scratch and
reproduced the problem again.

I also confirmed that the installed extension is current:

gh stack -v
gh stack version 0.1.1

gh extension upgrade github/gh-stack
[stack]: already up to date

This looks related to #250, but that issue reproduced on v0.0.8 and the
release notes indicate that amended-parent replay behavior has since been
fixed.

Happy to provide the repository or additional .git/gh-stack / rebase
metadata if useful.

主要语言
Go
星标
1.5k
派生
73
平均合并
1 天 8 小时
30 天内合并 PR
7

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

github/gh-stack 的其他 Issue

查看 github/gh-stack 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。