AI code review: shrink Git rename patches before paying

tutorialtroubleshootingworkflow

TL;DR: Inspect rename-aware Git output before sending a large refactor patch to an AI reviewer. A moved file can appear as a full deletion and addition when rename detection is disabled. Keep a complete path inventory, then use a separate readable patch to avoid paying to review unchanged text twice.

What you’ll be able to do:

  • Compare a rename-aware patch with an explicit deletion/addition view.
  • Reproduce the difference in a disposable repository without a paid model.
  • Preserve review scope while reducing redundant patch bytes.

Honest take: Use the rename-aware patch for reading and the complete path inventory for scope; neither artifact replaces the other.

Why did moving one file create a huge AI review packet?

A Git diff with rename detection disabled represents a file move as a deletion at the old path and an addition at the new path. If the contents are unchanged, that can make the review packet look much larger than the actual content change.

The issue often appears after a directory reorganization. An AI coding task moves a module, the review exporter uses --no-renames, and the reviewer receives both copies of the same text. Asking a model to explain that duplicated content uses context that could have been reserved for the actual edits and their tests.

Our merge-base review packet tutorial deliberately disables rename detection to simplify the artifact format. That remains a defensible inventory choice. This article adds a separate reading view for move-heavy changes rather than silently changing the meaning of that earlier exporter.

The official Git diff manual documents --no-renames, rename similarity thresholds, and the distinction between patch and summary output. The important decision is how to represent the same changes for a particular review purpose, not whether one command is universally correct.

What does Git actually record when a file moves?

Git’s diff machinery detects a rename from the compared contents; the displayed rename is not a guarantee that a special permanent rename record was stored. The git mv command is a convenient way to move a working file and update the index, as the git-mv manual describes.

That matters for reviewing an agent’s work. A file moved with ordinary filesystem commands and then staged can still be displayed as a rename. Conversely, heavily edited content may be presented as deletion and addition under a strict detection policy. Do not interpret the display alone as proof of which command the agent ran.

Diff policyWhat it emphasizesWhat can surprise the reviewer
--no-renamesSeparate old and new pathsFull unchanged contents can appear twice
--find-renames=100%Exact content matchesA move plus an edit is no longer an exact rename
--find-renames=50%Similarity-based pairingThe chosen pairing is a heuristic to inspect

The percentage in a rename summary describes content similarity under Git’s rules. It does not mean that the application remains equally correct, the tests cover that percentage, or the AI reviewer understood that fraction of the code.

How can you reproduce the patch-size difference locally?

Use a fresh disposable directory and make a single exact move. The following fixture uses Git and Python only. It does not run an AI coding agent, change a real project, or call a paid API.

mkdir rename-review-demo
cd rename-review-demo
git init -q
git config user.name Fixture
git config user.email fixture@example.invalid
git config core.autocrlf false
python3 - <<'PY'
from pathlib import Path
Path('before.txt').write_text(''.join(
    f'line {i:03d}: original content\n' for i in range(200)))
PY
git add before.txt
git commit -qm base
git mv before.txt after.txt
git diff --cached --no-ext-diff --no-textconv --no-color \
  --no-renames > without-renames.patch
git diff --cached --no-ext-diff --no-textconv --no-color \
  --find-renames=100% > exact-rename.patch
git diff --cached --find-renames=100% --summary
wc -c without-renames.patch exact-rename.patch

The two patch files are newly created, untracked fixture artifacts. They are outside the staged comparison and should stay outside any later staging command. In a real repository, write review exports to a separate evidence directory so a broad git add cannot accidentally add the review packet itself.

On Git 2.47.3 under Linux, checked November 12, 2026, this exact-content fixture produced:

 rename before.txt => after.txt (100%)
11461 without-renames.patch
  101 exact-rename.patch
11562 total

These are actual local patch-byte counts for the named fixture, not token counts, measured subscription savings, or a claim about all refactors. Different paths, content, line endings, Git options, and versions can change the output size. The useful observation is that the rename-aware representation carries the path move without repeating the full file.

What changes when the moved file is also edited?

A move plus a content edit needs a patch that shows both the path change and the edited lines. Keeping the exact-match threshold at 100% is useful for identifying pure moves, but it will not classify an edited file as an exact-content rename.

Continue the disposable fixture by changing one line and staging the intended file only:

python3 - <<'PY'
from pathlib import Path
p = Path('after.txt')
p.write_text(p.read_text().replace(
    'line 100: original content', 'line 100: edited content'))
PY
git add after.txt
git diff --cached --no-ext-diff --no-textconv --no-color \
  --find-renames=50% --summary
git diff --cached --no-ext-diff --no-textconv --no-color \
  --find-renames=50% > edited-rename.patch
wc -c edited-rename.patch

The tested fixture displayed a 99% similarity rename and produced a 430-byte patch with a normal content hunk. That result demonstrates the selected representation, not the correctness of the edit. An AI reviewer still needs to inspect the hunk and understand the destination’s role in the application.

Avoid lowering the threshold repeatedly until the output looks pleasing. In a change with many similar files, the pairing can become harder to interpret. Check the old/new path identities and contents directly if a proposed rename is surprising. Retain the deletion/addition view as a diagnostic artifact rather than forcing every move into a compact summary.

Which artifacts should an AI review packet contain?

Use a complete path inventory alongside a readable rename-aware patch. The inventory answers which locations changed; the patch answers what text the reviewer should read. Their purposes are related but distinct.

For a staged change, collect the raw path scope with a machine-safe delimiter and an explicit policy:

git diff --cached --no-ext-diff --no-textconv \
  --no-renames --name-status -z > staged-paths.z
git ls-files --others --exclude-standard -z > untracked-paths.z
git diff --cached --no-ext-diff --no-textconv --no-color \
  --find-renames=50% > staged-readable.patch

The NUL-delimited files are machine-readable inventories. Do not open them as ordinary line-based lists and assume a filename cannot contain a tab or newline. The Git ls-files documentation defines the untracked-file selection, while Git status explains index and working-tree distinctions.

In a real handoff, record the comparison scope and base commit next to these artifacts. A staged patch compares the index to the selected base; it does not automatically include later unstaged edits. If the agent continues editing after export, the review packet describes the earlier state. Re-export and re-run the relevant tests before relying on the review for publication.

The staged diff and untracked-file guide covers that boundary. Rename detection changes presentation within a comparison; it does not extend the comparison to files that were never selected.

How do you turn smaller patches into a defensible cost decision?

Measure the exported artifact first, then use your actual provider’s tokenizer and billing terms if you need a monetary estimate. A byte count is a reproducible local observation; it is not a universal conversion into tokens or dollars.

A hosted coding tool may construct its own context, add repository files, or summarize prior conversation. A compact patch pasted into one request does not prove that the vendor billed only that patch. Repeated attempts and extra output can outweigh a reduction in input text. Do not describe the fixture’s 11,461-to-101-byte change as a matching percentage reduction in your bill.

This workflow requires no GPU and adds no paid service. The local fixture uses an existing Git/Python installation and small text files. The practical resource cost in a real repository is the time to inspect move pairings and any Git work needed to detect similar files. The Git configuration manual documents rename-related settings; choose command-level options for the exported artifact instead of changing a team’s global defaults during a review experiment.

For a repeatable decision, compare packets from the same repository state. Keep the same requested review task and avoid counting unrelated added context as part of the rename effect. If you later run a paid comparison yourself, report the actual billed input/output and the quality checks separately. This article performed no such model comparison and claims no accepted-code or productivity improvement.

What can a compact rename patch hide from the reviewer?

An exact-content move can still break behavior through its new location. Relative imports, package discovery, route conventions, fixture paths, or build configuration may depend on where a file lives. A patch without content hunks is evidence that the contents match, not evidence that the move is behaviorally harmless.

Review the destination and the callers. Ask whether the test runner still discovers the moved tests and whether packaging still includes the module. Run the project’s documented acceptance commands from the intended working directory. A green text-diff review cannot substitute for those checks.

Binary files and submodules also need a separate boundary. A rename-aware text patch does not inspect binary semantics or the code inside a submodule commit. Use the binary and submodule review inventory to flag those cases before handing the packet to a model.

Honest take: when should you keep the longer view?

Keep the deletion/addition view when you are checking path scope, investigating an unexpected rename pairing, or need a simple parser with one path per record. Use the compact view when the same change contains many clear moves and the reviewer needs to focus on the actual edits.

Do not make compactness the acceptance criterion. A review packet earns its place by making the change understandable and complete enough for the requested review. If a shorter representation obscures which file became which, retain both views and explain the ambiguity directly.

For a routine move-heavy AI refactor, the best handoff is a complete inventory, a readable patch, the exact comparison base, and the relevant test results. That gives the reviewer enough structure to spend attention on behavior instead of repeated unchanged text.

Sources

Last updated November 12, 2026. Patch sizes are local Git fixtures, not model token measurements, billing results, or AI review-quality benchmarks.

Was this article helpful?

Know which coding tool is worth paying for

Hands-on comparisons of AI coding assistants and what each one costs to run — including the local-model path. Sent only when something changes. Unsubscribe anytime.