bstack
v1.5.2
Published
Create native GitHub stacked pull requests from a linear series of commits
Readme
bstack
Convert a series of commits in a local branch into a native GitHub stack of pull requests.
Install
npm install -g bstackInstall and authenticate the GitHub CLI with the stack extension:
gh auth login
gh extension install github/gh-stackHow to use
Write and edit commits locally. bstack handles the GitHub ops for you:
You
- Do not push your local feature branches.
- Do not open pull requests manually.
- Run
bstackwhen your commits are ready.
bstack pushes dedicated remote branches and creates one pull request for each commit.
Start a stack
Create a local branch from main, then make one commit per reviewable change:
git switch main
git switch -c my-feature
git commit -am "feat: add the model"
git commit -am "feat: add the API"
bstackThat is the whole publishing flow. Keep working on the same local branch and run bstack again whenever the stack changes.
Add another pull request
Add another commit on top of the stack, then run bstack:
git commit -am "feat: add validation"
bstackbstack keeps the existing pull requests and adds one for the new commit.
Modify a pull request
Edit the corresponding commit, then run bstack again. For the latest commit:
git commit --amend
bstackFor an older commit, use interactive rebase, mark that commit for editing, make your changes, and continue the rebase:
git rebase -i main
git commit --amend
git rebase --continue
bstackReorder pull requests
Reorder the corresponding commits with Git, then run bstack again.
bstack keeps the existing pull request identities and rebuilds the native GitHub stack in the new commit order.
Stacks cannot contain merge commits.
When main moves, rebase your branch onto it instead of merging main into your branch.
Checkout an existing stack
Use any pull request in the stack:
bstack checkout 123
bstack checkout https://github.com/owner/repo/pull/123Options
New pull requests are ready for review by default. Pass --draft to create
drafts instead.
Use --dry-run to inspect without syncing. Pass --verbose to print every
command before it runs.
