Rhynio

AI coding assistant changed every line? Check staged edits and line endings before committing

Your assistant made a small edit, but Git shows a whole-file rewrite. Compare the staged version with the last commit and the file on disk with the staged version to find the edits and see what a regular commit would include.

Review two diffs for the same file. Use git diff --cached for what’s staged and git diff for what changed since staging. Rerun each with --ignore-cr-at-eol to see which changes survive the line-ending filter.

A staged change can be reversed on disk

In this example, line-ending conversion is disabled for settings.txt. The file has three lines. Someone stages a change from theme=light to theme=dark. On disk, the line returns to theme=light and all three lines change from CRLF to LF.

HEAD · last commit
theme=light with CRLF
Index · staged version
theme=dark with CRLF
Working tree · on disk
theme=light with LF

Staged · HEAD to index

The normal diff shows one replacement. The same replacement survives the filter.

-theme=light
+theme=dark

Unstaged · index to working tree

The normal diff replaces all three lines. The filter leaves the reversal.

-theme=dark
+theme=light

The filtered HEAD-to-working-tree diff below is empty because the text in HEAD and on disk matches after filtering. That comparison skips the index, where the change to theme=dark is still staged.

git --literal-pathspecs diff --no-ext-diff --no-textconv --ignore-cr-at-eol HEAD -- "settings.txt"
Check your answer · which theme would a regular commit record?

Dark. A plain git commit uses the index as it stands. The return to light is still unstaged.

Run the paired diffs on your file

From the repository root, replace settings.txt with one quoted repo-relative path. Use a tracked plain-text file with an existing HEAD and a single, non-conflicted index entry. These commands inspect the file locally and leave its content and staging intact.

Staged · HEAD to index

git --literal-pathspecs diff --no-ext-diff --no-textconv --cached -- "settings.txt"
git --literal-pathspecs diff --no-ext-diff --no-textconv --cached --ignore-cr-at-eol -- "settings.txt"

Unstaged · index to working tree

git --literal-pathspecs diff --no-ext-diff --no-textconv -- "settings.txt"
git --literal-pathspecs diff --no-ext-diff --no-textconv --ignore-cr-at-eol -- "settings.txt"

The flag ignores carriage returns at line ends for the comparison. Changes to text or meaningful trailing spaces can still appear. The commands disable external diff helpers and text conversion for display. Repository normalization and clean filters can still affect how Git compares the file on disk.

If both filtered patches are empty, inspect the line-ending readings before drawing a conclusion. A changed file mode, a changed final newline, or an unexpected filter deserves its own review. Apply this walkthrough to ordinary text diffs, and check repository-specific rules if the file uses a custom clean filter or diff driver.

Git diff reference

An empty diff can hide a change to disk line endings

In a second fixture, settings.txt text eol=crlf stores normalized LF in the index and uses CRLF at checkout. The fixture starts with a CRLF checkout. Rewriting the same text with LF leaves the normal staged and unstaged diffs empty. Git compares the working tree using its normalized content.

git --literal-pathspecs ls-files --eol -- "settings.txt"

Here’s the reading after that rewrite, with spacing condensed.

i/lf  w/lf  attr/text eol=crlf  settings.txt
i/lf
Git sees LF in the index. This field describes the staged version.
w/lf
Git sees LF in the file on disk. This field describes the working tree.
attr/text eol=crlf
Git reports text normalization and a CRLF checkout rule.
Check your answer · what do you know about the file on disk?

The file on disk has LF despite the CRLF checkout rule. The empty diffs describe Git’s comparisons. The line-ending reading describes the present state. A before-and-after capture can narrow down when the bytes changed. Attributing the write takes evidence that ties it to a specific action.

Git ls-files reference · Git attributes reference

Reported examples

Windows users have reported CRLF-to-LF changes after assistant edits in specific setups. The walkthrough uses synthetic files and standard Git commands so the review works independently of an assistant’s interface.

Updated