मुख्य सामग्री पर जाएँ
Skillpedia
सामान्य कोडिंग41k · #6818

stacking-prs

यह क्या करती है

यह स्किल AI को gh stack कमांड-लाइन टूल से GitHub पर स्टैक्ड pull requests बनाने और संभालने का तरीका दिखाती है। यह उन डेवलपर्स के लिए है जो बड़े बदलाव को छोटी परतों में बाँटना चाहते हैं, ताकि उनकी समीक्षा आसान हो।

कब इस्तेमाल करें

  • ✓जब कोई कोड बदलाव एक pull request में समीक्षा के लिए बहुत बड़ा हो और आप उसे परतों में बाँटना चाहें।
  • ✓जब स्टैक में नीचे की pull request बदले और उसके ऊपर की परतें अपडेट करनी हों।
  • ✓जब आप pull requests के स्टैक को सही क्रम में मर्ज करना चाहें।

Skill का लिंक

https://github.com/PostHog/posthog/blob/master/.agents/skills/stacking-prs/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/PostHog/posthog/blob/master/.agents/skills/stacking-prs/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“मेरी बड़ी फ़ीचर ब्रांच को छोटे pull requests के स्टैक में बाँटिए, ताकि मैं उन्हें एक-एक करके समीक्षा कर सकूँ।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

स्टैक एक क्रम वाली शृंखला है, जिसमें हर pull request नीचे वाली पर बनती है। AI gh stack टूल से हर परत बनाता है, सबमिट करता है और अपडेट करता है, और किसी परत के बदलने पर ऊपर की परतों को रीबेस करता है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

Stacked PRs with gh stack

Before you divide a change into layers, check things already tried. It records when a stack cost more review effort than one PR.

GitHub's native stacked PRs are enabled on this repo. A stack is an ordered chain of PRs where each one targets the branch of the PR below it; the bottom PR targets master. GitHub tracks the chain as a first-class object: the PR UI shows a stack map, branch protections (code owner approval, required checks) apply to every layer including mid-stack ones, and CI that runs on master PRs runs on every layer.

Setup (this skill is written against gh-stack v0.1.0):

gh extension install github/gh-stack   # or: gh extension upgrade stack

Upstream docs: about stacked PRs, CLI commands.

In a cloud task sandbox, use gh_stack instead

The rest of this skill assumes a developer machine. Cloud task runs block git commit and git push so unsigned commits cannot leave the sandbox, which takes out every gh stack command that publishes a stack — submit, sync, push, and link with branch arguments all push, and gh stack add -m commits.

There, build the stack from the signed-commit tooling and link it with the gh_stack MCP tool, which drives GitHub's Stacks REST API and never pushes:

  1. Commit each layer with git_signed_commit, passing a new branch — the checkout already sits on the layer below, so the branch starts there.
  2. Open each layer's PR with gh pr create --base <branch of the layer below>.
  3. Link them with gh_stack, operation create, passing pull_requests bottom to top.

To restack a layer: check that layer out, git rebase <its parent branch>, then republish it with git_signed_rewrite passing onto = the parent branch. gh stack rebase still does the rebase itself, but nothing may publish the result — gh stack push and gh stack sync both push. git_signed_rewrite replays whatever local HEAD points at and uses branch only to pick which remote ref moves, so the layer has to be the checked-out branch or you publish the wrong history to it.

Create a stack

gh stack init my-feature-db        # bottom branch, based on master
# ...commit...
gh stack add my-feature-api        # next layer, based on the previous branch
# ...commit...
gh stack add -Am "add UI" my-feature-ui   # stage all + commit in one step
  • Adopt existing local branches (bottom to top): gh stack init branch1 branch2 branch3.
  • Link PRs that already exist on GitHub, without local tracking: gh stack link <pr> <pr> <pr>, bottom to top (branch names and PR URLs work too). Pass a stack number first to append to an existing stack: gh stack link <stack> <pr>.
  • Slice by reviewable unit: migration / backend / frontend, or mechanical-rename / behavior-change. Each PR must make sense to review and merge alone.
  • Keep stacks shallow (2–4 layers). Every layer multiplies CI cost and rebase churn, and deep-stack pushes can trip GitHub's dispatch cap (see AGENTS.md, "Stacked PRs"). The pre-push hook and the Stack depth check block a layer above the fifth open one (merged layers don't count). For more work on top, run gh stack init --base <top branch> <new branch> from master, because gh-stack refuses to start a stack from a layer of another one. Rebase the new stack onto master once the lower stack lands.
  • Place a CI-heavy layer by how CI diffs it:
    • Most jobs pick their work from the layer's own diff against its parent, so such a layer does not make the layers above it heavy. A push to any layer below it starts its jobs again (see the duplicate-run note under "Iterate and keep in sync"). Put it low, unless it is the layer that still changes most.
    • A few steps diff against master, so they repeat on layers above the change. Trunk's impacted-targets job runs on every layer and computes affected crates when rust/ or proto/ differs. Backend jobs build the HogQL parser from source when common/hogql_parser/ or rust/hogql/parser/ differs, and Playwright jobs when common/hogql_parser/ differs. Those builds repeat only on upper layers whose own diff starts backend or Playwright jobs. If upper layers do, put the parser change in the top layer.
  • Put every change that moves a visual review snapshot, Storybook
अक्सर पूछे जाने वाले सवाल

स्टैक्ड pull request क्या है?

यह pull requests की एक शृंखला है, जिसमें हर एक नीचे वाली की ब्रांच को लक्ष्य बनाती है, और सबसे नीचे वाली मुख्य ब्रांच को।

क्या मुझे gh कमांड-लाइन टूल चाहिए?

हाँ। यह स्किल GitHub का gh stack एक्सटेंशन इस्तेमाल करती है, जिसे आप GitHub CLI के साथ एक बार इंस्टॉल करते हैं।

क्या नई pull requests ड्राफ़्ट के रूप में शुरू होनी चाहिए?

स्किल स्टैक पहले ड्राफ़्ट के रूप में बनाती है, ताकि किसी के समीक्षा करने से पहले हर परत जाँची जा सके।

जानकारी

लेखक का मूल विवरण

Create and manage GitHub native Stacked PRs in this repo with the `gh stack` CLI. Use when asked to stack PRs, split a large change into a stack, add a layer to a stack, restack or rebase a stack, adopt existing branches or PRs into a stack, check out someone else's stack, or land a stack. Covers creating and submitting stacks (draft-first), cascade rebases with `gh stack sync`, and landing one through the Trunk merge queue via `/merging-prs` — whole-stack via `trunk merge` on the top layer, or bottom-first — never `gh stack merge`.

repo: PostHog/posthog

लोकप्रियता

GitHub स्टार
41k
रैंकिंग में स्थान
#6818
लाइसेंस
—
अपडेट की गई
2/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

depot-ci

41k

यह आपके एजेंट को Depot CI वर्कफ़्लो सेट अप करने, चलाने और माइग्रेट करने में मदद करती है, साथ ही रन के लॉग पढ़ने में।

कोडिंगडिप्लॉय और क्लाउड (DevOps)

depot-container-builds

41k

यह आपके एजेंट को Depot के रिमोट बिल्डर पर Docker इमेज बनाने में मदद करती है, जिसमें मल्टी-प्लेटफ़ॉर्म इमेज और बिल्ड सुधार शामिल हैं।

कोडिंगडिप्लॉय और क्लाउड (DevOps)

depot-github-runners

41k

यह आपके एजेंट को GitHub Actions जॉब Depot के मैनेज्ड रनर पर ले जाने, रनर का साइज़ और लेबल चुनने, और रनर सेटअप की समस्याएँ ठीक करने में मदद करती है।

कोडिंगडिप्लॉय और क्लाउड (DevOps)

editing-agents-md

41k

यह आपके एजेंट को तय करने में मदद करती है कि कोई नियम AGENTS.md या CLAUDE.md में जाए या नहीं, और उसे ऐसे लिखे कि फ़ाइल भारी न हो।

AI और एजेंटएजेंट

मिलती-जुलती skills