Skip to content

fix(merge): push restacked branches after each stack merge step#20

Merged
rohoswagger merged 1 commit into
mainfrom
fix/merge-push-after-restack
May 9, 2026
Merged

fix(merge): push restacked branches after each stack merge step#20
rohoswagger merged 1 commit into
mainfrom
fix/merge-push-after-restack

Conversation

@rohoswagger
Copy link
Copy Markdown
Owner

@rohoswagger rohoswagger commented May 8, 2026

What changed

After each successful ez merge (single PR or each step of ez merge --stack), any branch that was restacked locally is git fetch + git push --force-with-lease’d so GitHub’s PR head matches the rebased commits before the next merge runs. That fixes stack merges failing on the next PR with merge conflicts until you manually ran ez restack and force‑pushed.

Merge receipts JSON now include restacked and pushed_branches per step.

ez merge --help doc line notes the push behavior.

Example: ez merge --stack --yes

Stack

Branch Parent PR
feat/auth main #180
feat/api feat/auth #181
feat/ui feat/api #182

Run from tip (or any branch in the line):

ez merge --stack --yes --method squash

ez merges bottom → top: [feat/auth, feat/api, feat/ui].

Round 1 (#180)

  1. Squash-merge PR #180 on GitHub.
  2. Reparent dependents onto main, try gh pr edit --base main for child PRs.
  3. Cleanup local/remote merged branch, git fetch.
  4. Restack branches whose parent_head is stale (e.g. feat/api, feat/ui onto updated main).
  5. Push each branch that was restacked (--force-with-lease).

Round 2 (#181) — same pattern; push restacked dependents (e.g. feat/ui) so PR #182 is mergeable.

Round 3 (#182) — merge last PR; restack/push if anything still moved.

Single PR

ez merge --yes --method squash

Merges only the stack bottom PR for your current line; the global restack + push loop still runs afterward so dependents stay aligned with trunk.


--method is GitHub’s merge_method: squash (default), merge, or rebase.

@rohoswagger rohoswagger merged commit cf24eaf into main May 9, 2026
4 checks passed
@rohoswagger rohoswagger deleted the fix/merge-push-after-restack branch May 9, 2026 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant