You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Diff view: compare a stacked branch against its parent layer and switch between layers
#41613
I split larger changes into GitHub-native stacks (gh stack). The PR panel already handles this well: the 2/3 stack button lets me jump between layers, and the Code tab shows each PR's diff (#6595, #10875).
The thread's Diff view doesn't know about stacks. In the Changes comparison, the base defaults to the repository's default branch. On layer 3 of a stack, I see layers 1–3 combined instead of the changes the agent and I are making in this layer. To see only this layer, I have to find the parent branch myself in the base ref picker, which lists every local and remote branch. To look at another layer, I have to check out its branch and pick its base again.
The Diff view is where I review agent work before pushing, so that's where I need the per-layer view, not only after a PR exists.
Proposed solution
When the checked-out branch is the head of a layer in a GitHub-native stack:
Default base = parent layer. In Changes, compare against the head branch of the layer below. For the bottom layer, use the stack's base. Show this in the base label, e.g. Base: kb/http-client (stack #17, layer 1).
Stack-aware base picker. List the stack's layers at the top of the base ref picker, above the full branch list. Then I can also compare against the stack base to see the whole stack at once.
Layer switcher (nice to have). Add a 2/3 control like the PR panel's that shows another layer's diff (that layer's head vs. its parent) without checking it out. The Diff view currently reads the local checkout, so this needs the two refs fetched locally.
Smallest useful scope
Default the Changes base to the parent layer's branch when the current branch is a stack layer, and list the stack's layers first in the base picker. No switching without checkout.
Alternatives considered
Use the PR panel's Code tab. It only works once a PR is pushed and open, it shows the pushed head rather than local changes, and it lives in a different surface from the turn and branch diffs.
Pick the parent branch by hand. This works, but it's error-prone with several stacks, and the base T3 remembers per thread doesn't follow when I move between layers.
baseRefChoices.ts: the base picker is a flat list of local and remote refs, with no stack awareness.
The stack data already exists for the PR panel (usePullRequestStack, PullRequestStackLayers), so the Diff view could reuse it when the current branch matches a layer's headBranch.
Related
#32148 Allow Changes totals to focus on the current PR or committed branch. Its "current PR" mode would compare a layer against its PR base, which is the parent layer, but it doesn't mention stacks or switching layers.
#31564 Step between commits in the Diff pane. Same "step through" idea, but per commit rather than per stack layer.
#35579 Show GitLab stacked MRs in the MR review tool. Asks for stacks in the PR/MR panel only.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Problem or use case
I split larger changes into GitHub-native stacks (
gh stack). The PR panel already handles this well: the2/3stack button lets me jump between layers, and the Code tab shows each PR's diff (#6595, #10875).The thread's Diff view doesn't know about stacks. In the Changes comparison, the base defaults to the repository's default branch. On layer 3 of a stack, I see layers 1–3 combined instead of the changes the agent and I are making in this layer. To see only this layer, I have to find the parent branch myself in the base ref picker, which lists every local and remote branch. To look at another layer, I have to check out its branch and pick its base again.
The Diff view is where I review agent work before pushing, so that's where I need the per-layer view, not only after a PR exists.
Proposed solution
When the checked-out branch is the head of a layer in a GitHub-native stack:
Base: kb/http-client (stack #17, layer 1).2/3control like the PR panel's that shows another layer's diff (that layer's head vs. its parent) without checking it out. The Diff view currently reads the local checkout, so this needs the two refs fetched locally.Smallest useful scope
Default the Changes base to the parent layer's branch when the current branch is a stack layer, and list the stack's layers first in the base picker. No switching without checkout.
Alternatives considered
Notes from the source
DiffPanel.tsx: Changes comparison (kind: "branch"),rememberedBaseRef/selectedBaseRef.baseRefChoices.ts: the base picker is a flat list of local and remote refs, with no stack awareness.usePullRequestStack,PullRequestStackLayers), so the Diff view could reuse it when the current branch matches a layer'sheadBranch.Related
All reactions