askill
graphite-is-being-a-piece-of-shit-just-merge-my-stack

graphite-is-being-a-piece-of-shit-just-merge-my-stackSafety 72Repository

Merge a stacked Graphite branch chain with gh by retargeting each PR to main and merging bottom to top, including conflict recovery via rebase.

5.1k stars
101.8k downloads
Updated 2/28/2026

Package Files

Loading files...
SKILL.md

Merge a stacked PR chain when Graphite automation is failing.

Input: A target branch in the stack (usually the top branch to merge through).

Goal: Merge all PRs from the bottom of that stack up to the target branch.

Steps

  1. Resolve the target PR

    • Find PR for the provided branch:
      • gh pr list --state open --head "<target-branch>" --json number,headRefName,baseRefName,url
    • If no open PR exists, stop and report.
  2. Build the stack chain down to main

    • Start at target PR.
    • Repeatedly find the PR whose headRefName equals the current PR baseRefName.
    • Continue until base is main or no parent PR exists.
    • If chain is ambiguous, stop and ask the user which branch to follow.
  3. Determine merge order

    • Merge from bottom to top.
    • Example: [bottom, ..., target].
  4. For each PR in order

    • Retarget to main before merge:
      • gh pr edit <pr-number> --base main
    • Merge with repository-compatible strategy:
      • Try gh pr merge <pr-number> --squash --delete-branch=false
    • If merge fails due conflicts:
      • gh pr checkout <pr-number>
      • git fetch origin main
      • git rebase origin/main
      • Resolve conflicts. If replaying already-upstream commits from lower stack layers, prefer git rebase --skip.
      • Continue with GIT_EDITOR=true git rebase --continue when needed.
      • git push --force-with-lease origin <head-branch>
      • Retry gh pr merge ... --squash.
  5. Verify completion

    • Confirm each PR in chain is merged:
      • gh pr view <pr-number> --json state,mergedAt,url
    • Report final ordered merge list with PR numbers and timestamps.

Guardrails

  • Always merge in bottom-to-top order.
  • Do not use merge commits if the repo disallows them.
  • Do not delete remote branches unless explicitly requested.
  • If a conflict cannot be safely resolved, stop and ask the user.
  • If force-push is required, use --force-with-lease, never --force.
  • After finishing, return to the user's original branch unless they asked otherwise.

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

52/100Analyzed 3/2/2026

Functional skill with detailed steps for merging stacked Graphite PRs, but severely limited by unprofessional naming, narrow focus on a specific tool (Graphite), and internal-only indicators from the .codex path. Has good structure and safety practices but lacks broad reusability.

72
75
25
72
88

Metadata

Licenseunknown
Version-
Updated2/28/2026
Publisherrivet-dev

Tags

ci-cd