Skip to content

Sync stacks with the remote trunk when the local one can't move - #67

Merged
DomBlack merged 1 commit into
dom/gh-stack-shared-catalogfrom
dom/sync-remote-trunk
Nov 4, 2026
Merged

DomBlack merged 1 commit into
dom/gh-stack-shared-catalogfrom
dom/sync-remote-trunk

Conversation

@DomBlack

@DomBlack DomBlack commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

If trunk is checked out somewhere with a change in the way of its fast forward (an uncommitted go.work.sum in the main checkout while you're working in a linked worktree, say), sync leaves trunk where it is, which is right. But everything after that then worked from the stale tip: a branch whose PR had merged was kept ("merged into main but that isn't in main yet") and the branches above it weren't restacked past it. The submit that syncs first then went ahead and opened a PR carrying the already merged commits, pulling in their reviewers too.

Now, for a trunk that was only behind its remote, sync uses the remote's tip in its place for cleanup and restack, and adds a notice saying so. The local trunk is still left alone and the result still says it wasn't updated; once the change is out of the way it fast forwards onto the same commits.

When trunk is checked out somewhere with a change in the way of its fast
forward (say an uncommitted go.work.sum in the main checkout while you
work in a linked worktree), sync left trunk behind, and then everything
after it worked from that stale tip. A branch whose pull request had
merged was kept ("merged into main but that isn't in main yet"), and the
branches above it weren't restacked past it, so the submit that syncs
first went on to open a pull request carrying the already merged commits
and pulled in their reviewers.

For a trunk that was only behind its remote, sync now uses the remote's
tip in its place for cleanup and restack, and says so in a notice. Local
trunk is still left alone and the result still says it wasn't updated;
it fast forwards onto the same commits once the change is out of the way.
@DomBlack
DomBlack added this pull request to stack #70 November 4, 2026 17:08
@DomBlack DomBlack added the bug Something isn't working label Nov 4, 2026
@DomBlack
DomBlack merged commit 89fedf2 into main Nov 4, 2026
5 checks passed
@DomBlack
DomBlack deleted the dom/sync-remote-trunk branch November 4, 2026 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant