Add a way to sync a stack from the remote without pushing
还没有人认领这个 Issue。
评估
调研方向
Start with the existing gh stack sync command and trace how it fetches, rebases, and pushes stack branches. Compare that flow with the documented git fetch --all --prune and branch-reset sequence. Done means a sync mode or command updates local stack branches from their remotes without rebasing, pushing, or creating duplicate commits.
由索引模型根据 Issue 内容生成。
描述
When a stack has been restacked and force-pushed from elsewhere either by a collaborator, or the rebase option on gh webapp my local branches are left with the pre-rebase SHAs. With stack view every branch shows as ahead N, behind N against its remote, but the "ahead" commits are just stale copies of work that's already upstream under different hashes.
What I want in that situation is "make my local stack match the remote". as far as I am aware gh stack sync is close to doing this, but it always pushes (--force-with-lease --atomic), which is the opposite direction, and there's no flag to stop it.
It also doesn't just no-op, it rebases those stale local commits onto the updated parents, which replays commits that are already upstream. I ended up with empty duplicate commits on a branch that way, including one that kept its original co-authors on a no-op.
So what I end up doing when I want my local to match the remote stack is:
git fetch --all --prune
for every stack branch git branch -f "$branch" "origin/$b"
I think a good solution would be either a flag on sync (--no-push, or a --reset/--from-remote mode) or a separate
command, that fetches and points each local stack branch at its remote without rebasing or pushing anything. You could even have sync detect this case where local is ahead only by commits whose patch-id already exists upstream rather than directly with a flag.
- 主要语言
- Go
- 星标
- 1.5k
- 派生
- 73
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 7
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 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
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
NVIDIA/gpu-operator#2955 ·
-
agentic-workflows
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 1/5 1 小时以内 新手友好度 90/100
kovidgoyal/kitty#10516 ·
-
bug
难度 1/5 1 小时以内 新手友好度 90/100
cisagov/vulnrichment#337 ·
-
难度 1/5 1 小时以内 新手友好度 72/100