git status shows modifications even with autocrlffalse
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Introduction
If git status shows files as modified even though core.autocrlf=false, the cause is usually broader than line-ending conversion. autocrlf=false only tells Git not to rewrite line endings automatically on checkout and commit; it does not disable .gitattributes, editor changes, file-mode tracking, BOM changes, or clean and smudge filters.
Start by asking what actually changed
The first step is to inspect the diff rather than guessing:
If the diff looks empty, compare with line-ending-insensitive output:
If the file stops showing changes with --ignore-cr-at-eol, line endings are involved. If not, the issue is somewhere else.
autocrlf=false does not override .gitattributes
Many developers miss this. Repository-level attributes can still normalize line endings even when the local Git config disables autocrlf.
For example:
In that repository, Git still has explicit end-of-line rules. So if your editor writes a file with the wrong convention, git status can show modifications even though core.autocrlf is false.
To inspect attributes:
That command is often more revealing than staring at global config.
Other common causes besides line endings
Several non-EOL issues can make a file appear modified:
- executable bit changes on Unix-like systems
- UTF-8 BOM added or removed
- trailing whitespace stripped by the editor
- clean and smudge filters rewriting content
- generated files or formatters touching the file automatically
If the problem is file mode, check:
On some filesystems, setting:
reduces noisy permission-only changes.
Check the editor and tools around Git
Editors often normalize files on save. A file can be "modified" without any visible text edit because the editor changed:
- line endings
- encoding
- BOM presence
- final newline
- whitespace indentation
That is why the issue can appear even in a repo with careful Git config. Git is just reporting that the bytes changed.
If only one editor produces the problem, inspect that editor's save settings before changing Git defaults across the whole machine.
Another useful check is to compare the file in the index against the working tree with a binary-aware tool. When the diff looks invisible in the terminal, encoding markers or whitespace normalization are often the missing explanation.
A practical diagnosis flow
A reliable troubleshooting sequence is:
- run
git diff -- path/to/file - run
git diff --ignore-cr-at-eol -- path/to/file - run
git check-attr -a -- path/to/file - inspect file mode, encoding, and editor save settings
That path usually reveals whether the problem is:
- EOL normalization
- repository attributes
- permission metadata
- editor or formatter behavior
It is much more effective than toggling autocrlf repeatedly.
Common Pitfalls
The biggest mistake is assuming core.autocrlf=false means "Git will never show text-format-related modifications." It only disables one conversion behavior.
Another mistake is ignoring .gitattributes. Repository rules often matter more than local Git config because they travel with the project.
Developers also overlook file-mode changes on Linux and macOS, especially when working on mounted or unusual filesystems.
Finally, do not reset files blindly before understanding the cause. If an editor or formatter is rewriting them automatically, the noise will come back immediately.
Summary
- '
core.autocrlf=falsedisables one Git conversion mechanism, not every source of file modification.' - Use
git diffandgit diff --ignore-cr-at-eolto see whether line endings are really the issue. - Check
.gitattributes, because repository rules can still enforce EOL behavior. - Inspect file mode, encoding, BOM, and editor save settings too.
- Diagnose the actual byte-level change instead of toggling Git config blindly.
Related reading
- git still shows files as modified after adding to .gitignore
- Git submodule add a git directory is found locally issue
- Git submodule head 'reference is not a tree' error
- git submodule update --init gives error fatal Needed a single revision Unable to find current revision in submodule path
- git submodule update --remote vs git pull
- git submodule update failed with 'fatal detected dubious ownership in repository at...
- git svn - Can I use git and svn at the same time? no need interaction between git and svn
- git svn clone malformed index info error
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.