Skip to content

About

gh extension: smart rebase after squash-merge of parent PR

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

15 Commits

Folders and files

Repository files navigation

gh-rebased

Your branch survived the squash. Now rebase it properly.

When a parent PR in your stack gets squash-merged, a plain git rebase doesn't know what GitHub knows. It replays commits that are already in the base — just wearing a different SHA — and chaos follows.

gh-rebased asks GitHub which commits got squashed, drops them before the rebase runs, and gets out of your way.


Yes.

your branch, rebased.


Install

gh extension install stephenc-ori/gh-rebased

Usage

From your stacked branch, after the parent PR has been squash-merged:

gh rebased

That's it. It fetches the target branch, detects squash-merged parent commits, and runs the rebase — dropping only what's already been incorporated upstream.

How it works

  1. Finds the open PR for your current branch and its target branch
  2. Fetches origin/<target> and computes the divergence point
  3. For each new commit on the target, asks GitHub which PR it came from
  4. If one new commit maps to a PR with multiple original commits → squash merge detected
  5. Drops those original commits via GIT_SEQUENCE_EDITOR before git rebase -i runs
  6. Rebase merges and single-commit PRs are left alone — git rebase handles those via patch-ID matching

See also

These tools take a broader approach to stacked PR workflows:

  • git-machete — full branch relationship manager with rebase automation across the whole stack
  • gh-stack — GitHub's official stacked PR extension; handles cascading rebases and PR creation
  • gh-domino — rebases stacked PRs like dominoes when one in the chain is merged

gh-rebased is narrower: it does one thing, on one branch, when you need it.

License

MIT

About

gh extension: smart rebase after squash-merge of parent PR

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages