chore: add squash gen for better rebasing#2996
Conversation
This thing re-writes your whole commit history to match the merge-base with origin main (or the previous explicit gen commit). It then bundles up all the generated code into a single commit. This let's you run rebases in a pleasant manner without crashing into a billion merge conflicts It works nicely with git rebase TODOs with: x mise git:squash-gen x mise git:squash-gen --drop x mise git:squash-gen --amend
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 204349115b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // ---------- precondition checks ---------------------------------------------- | ||
|
|
||
| async function assertCleanWorktree(): Promise<void> { | ||
| const status = await git("status", "--porcelain", "--untracked-files=no"); |
There was a problem hiding this comment.
Reject untracked files before squashing generated artifacts
assertCleanWorktree only checks tracked changes (--untracked-files=no), but the later staging step explicitly includes untracked files (git ls-files --others --exclude-standard). That means an unrelated untracked file under a generated path (for example, a stale file left in server/gen/ or client/sdk/) will be silently swept into the new chore(gen) commit, which can pollute history with unintended artifacts. The precondition should fail when untracked files are present (or at least when untracked generated files are present) to keep the rewrite deterministic.
Useful? React with 👍 / 👎.
It's getting vibe-y in here
this can make reviewing a PR like this:
https://github.com/speakeasy-api/gram/pull/2965/changes
to more like this (with one easy commit filter)
https://github.com/speakeasy-api/gram/pull/2965/changes/BASE..1dfb316f23346b808762769feb41df06ff83e9e7
This thing re-writes your whole commit history to reset all generated files to
match the merge-base on
origin/main(or the previous explicit gen commit). It then bundles up all thegenerated code into a single commit.
This let's you run rebases in a pleasant manner
without crashing into a billion merge conflicts
It works nicely with git rebase TODOs with directives like: