All articles

Split AI Changes into Pull Requests Teammates Can Review

Keep AI-generated code accountable by narrowing scope, rebuilding coherent commits, and splitting risky changes into pull requests teammates can understand.

Source and AI note: This article is based on Gemini’s Devpractice on YouTube. It was generated and edited with the gpt-5.6-sol model.

AI can create a large diff before the author has decided how teammates should read it. That does not change the ownership of the result. Code running inside a company is a shared asset, and the person submitting the change still owes the team an understandable review path.

The practical response is to treat commit and pull-request design as part of the work. A generated change is not ready merely because the implementation and tests exist.

Rebuild the history for the reader

Working commits are useful checkpoints, but they do not have to become the final review history. My usual workflow is to collect the completed branch, then rebuild commits around coherent changes so a reviewer can follow the reasoning without replaying every intermediate correction.

If one file is edited across many working commits, the final history may be easier to read when its related change appears once. Preparatory refactoring or package movement can be separated and merged before the feature work. That keeps mechanical movement from hiding the behavior under review.

This is not history polishing for its own sake. Pull requests remain after merge. They help teammates understand what changed now and help future maintainers recover why it changed.

A huge diff often reveals an oversized request

Two hundred or five hundred changed files are examples of excessive scope, not universal thresholds. A coherent mechanical change can legitimately touch many files, while a ten-file change can still mix unrelated concerns.

When a request that seemed small produces a very broad diff, first question the scope. Several jobs may have been handed to the agent in one session. Split the behavior, preparatory refactoring, and migration work into separate branches or pull requests when those pieces can be understood and delivered independently.

The agent can help with this while the working context is still available. Ask it to group changes, reconstruct commits, prepare branches, and draft a pull-request description that records the path taken. The author still has to inspect those groups and decide whether they make sense.

Match review effort to failure cost

A toy project owned by one person can accept a rougher history. Shared production code needs more care because another person must understand it, operate it, and respond when it fails.

The bar rises again for payment, settlement, financial, or high-traffic paths where an outage causes immediate business loss. Generated tests help, but their presence does not guarantee that the change cannot cause an incident. Review scope, understandable commits, and an explicit pull-request description remain part of risk control.

The important record is not who typed each line. It is who can explain the change, how teammates can review it, and whether the organization can maintain it after merge. AI makes code production cheaper; it does not make incomprehensible changes cheaper for everyone else.