`gh stack rebase` uses the wrong onto boundary for merged branches
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 84/100
調査の方向性
Start in internal/github/github.go and cmd/utils.go, then read cmd/rebase_test.go for the existing rebase boundary behavior. Run the rebase test and review the linked commit for the intended remote-versus-local SHA scenario. Done means the test covers local SHA A versus remote SHA B and gh stack rebase selects the remote merge point.
索引モデルが issue の本文から書いたものです。
説明
Problem: gh-stack needs to know "what was branch X's last commit right before it got merged" so it can skip replaying that history into upstack branches. Currently, it resolves this from the local clone instead of GitHub.
So, if branch X gets rebased elsewhere before merging, the local copy goes stale. That's normal and expected, however gh stack rebase fails to notice this and tries to replay from the wrong commit. This has led to spurious merge conflicts on files I didn't even touch, leading me to rebasing branches one-by-one or fixing the gh-stack state by hand (or with an agent).
Fix: I wrote a fix here. Full disclosure: I used Claude to write the fix but I manually reviewed and edited it afterwards.
I would open a PR for this but it's locked to contributors only.
Changes:
internal/github/github.go: Add one field,HeadRefOid, toPullRequest. This tracks the remote's record of the exact commit which was merged.cmd/utils.go:- When a PR is detected as merged, save its
HeadRefOidvalue. - When computing the rebase boundary, use
HeadRefOidinstead of getting the (possibly stale) local SHA throughgit.
- When a PR is detected as merged, save its
cmd/rebase_test.go: Add a test that fakes the problem scenario ("local has SHA A, but remote has SHA B (the real merge point)" and checks the tool picks B. This test fails without the above fixes, and passes with them.
Net effect: The onto boundary now comes from remote / GitHub (can't go stale) instead of local, eliminating confusing rebase conflicts due to a misconfigured rebase.
- 主要言語
- Go
- スター
- 1.5k
- フォーク
- 73
- 平均マージ
- 1日 8時間
- マージ済み PR(30日)
- 7
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
github/gh-stack のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
-
feature request topic: cli - general
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
feature request topic: auto-merge
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
bug topic: docs
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
github/gh-stack の issue をすべて見る
似ている issue
-
textual definition
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
geneontology/go-ontology#32653 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
-
needs design
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
Priority/High ready-for-agent Severity/Major Type/Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100