Title: Design: separate a stacked PR's merge target from its base · Issue #157 · github/gh-stack · GitHub
Open Graph Title: Design: separate a stacked PR's merge target from its base · Issue #157 · github/gh-stack
X Title: Design: separate a stacked PR's merge target from its base · Issue #157 · github/gh-stack
Description: From Overview / What Is a Stack?: A pull request stack consists of two or more pull requests in the same repository where: The first (bottom) pull request targets the main branch (e.g., main). Each subsequent pull request targets the bra...
Open Graph Description: From Overview / What Is a Stack?: A pull request stack consists of two or more pull requests in the same repository where: The first (bottom) pull request targets the main branch (e.g., main). Each...
X Description: From Overview / What Is a Stack?: A pull request stack consists of two or more pull requests in the same repository where: The first (bottom) pull request targets the main branch (e.g., main). Each...
Opengraph URL: https://github.com/github/gh-stack/issues/157
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Design: separate a stacked PR's merge target from its base","articleBody":"From [Overview / What Is a Stack?](https://github.github.com/gh-stack/introduction/overview/#what-is-a-stack):\n\n\u003e A pull request stack consists of two or more pull requests in the same repository where:\n\u003e\n\u003e - The first (bottom) pull request targets the main branch (e.g., main).\n\u003e - Each subsequent pull request targets the branch of the PR below it.\n ```\n ┌── feat/frontend → PR #3 (base: feat/api-endpoints) ← top\n ┌── feat/api-endpoints → PR #2 (base: feat/auth-layer)\n ┌── feat/auth-layer → PR #1 (base: main) ← bottom\n main (trunk)\n ```\n\n[endquote]\n\n_Merging to the base branch is fundamentally wrong for this._ In your example here, `api-endpoints` is not logically *part of* `auth-layer`, so should not merge to it. You should separate \"base\" and \"target\" (e.g. `main`, `super-feature`, etc). Normally all branches in a stack will merge to the same target.\n\nYou already track \"target\" as distinct from base - your own [Overview](https://github.github.com/gh-stack/introduction/overview/#what-is-a-stack) states each PR is evaluated for rules and protections using \"its final target branch (e.g., `main`), not the branch it directly targets.\" So the concept exists; it's just confined to rule evaluation and discarded everywhere else. Promote it to a first-class merge destination.\n\nResult should be something like:\n\n```\n$ git log --all --graph --decorate --pretty=oneline --abbrev-commit\n* 043bf03 (HEAD -\u003e main) Merge pull request #2 from username/feat/2\n|\\\n| * 88624f8 (feat/2) Feature 2\n* | 39f3460 Merge pull request #1 from username/feat/1\n|\\|\n| * 0f1e961 (feat/1) Feature 1\n|/\n* 04a9dac Initial commit\n```\n\nRelated, I made the [same point to Git Butler](https://github.com/gitbutlerapp/gitbutler/issues/10936), but they're constrained by the existing GitHub implementation. But you are GitHub, now deciding the next implementation - not constrained.\n\nAlong with this, the implementation should display and enforce \"below\" branches in the stack as prerequisites. `feat/2` should be blocked from merging until `feat/1` has merged. You'll have to make this explicit, instead of just a side effect of merging to the base branches.","author":{"url":"https://github.com/bmcdonnell-fb","@type":"Person","name":"bmcdonnell-fb"},"datePublished":"2026-06-29T20:36:19.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/157/gh-stack/issues/157"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ede22632-ee21-76a2-c32d-c5d2b92ca687 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D8A8:20853D:67EB6B1:9151104:6A4FBAC8 |
| html-safe-nonce | 3e6c53285a02bfe39e0d1481be658097aa618d8d06f3472ef83ba581ceefe88a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOEE4OjIwODUzRDo2N0VCNkIxOjkxNTExMDQ6NkE0RkJBQzgiLCJ2aXNpdG9yX2lkIjoiMTE5MTczMzg3NjAwODkyNTg5NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c7d8b1707d9e64b6af376e6eba97e5a2d7b64db403816e7e5fae2a637038bece |
| hovercard-subject-tag | issue:4771414808 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/github/gh-stack/157/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d1d335450076382c9bfaa74db19a93e930bf4427512f10506f8ecf0a593f4859/github/gh-stack/issues/157 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d1d335450076382c9bfaa74db19a93e930bf4427512f10506f8ecf0a593f4859/github/gh-stack/issues/157 |
| og:image:alt | From Overview / What Is a Stack?: A pull request stack consists of two or more pull requests in the same repository where: The first (bottom) pull request targets the main branch (e.g., main). Each... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bmcdonnell-fb |
| hostname | github.com |
| expected-hostname | github.com |
| None | b92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9 |
| turbo-cache-control | no-preview |
| go-import | github.com/github/gh-stack git https://github.com/github/gh-stack.git |
| octolytics-dimension-user_id | 9919 |
| octolytics-dimension-user_login | github |
| octolytics-dimension-repository_id | 1151630728 |
| octolytics-dimension-repository_nwo | github/gh-stack |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1151630728 |
| octolytics-dimension-repository_network_root_nwo | github/gh-stack |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4b249b445842943ed31549e027f57a8ade9881ed |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width