Checks
Warnings: line endings and git version
3 min read
Two warnings help you avoid surprises that aren't anyone's fault: line endings that change without you noticing (and make a whole file show up as changed for people who use LF), and a git that's too old for some app feature.
Both are in Preferences (Ctrl+,) › Operations › Warnings group.
Windows uses CRLF at the end of lines; Linux and macOS use LF. Depending on core.autocrlf and
.gitattributes, git can store the file with CRLF in the repository or convert the line endings on
disk the next time it writes the file. Versora checks the staged files before the commit and warns
you in these cases:
| Case | Warning | Explanation |
|---|---|---|
| CRLF in the commit | "src/app.ts goes into the commit with CRLF" | With core.autocrlf=false (or no setting) and no .gitattributes normalizing the file, CRLF is stored in the repository and shows up as a change for people using LF. To normalize, use core.autocrlf=true (Windows) or a .gitattributes with * text=auto. |
| Mixed endings | "src/app.ts goes into the commit with mixed line endings (CRLF and LF)" | CRLF and LF lines in the same file usually come from copy and paste or from two editors. Git stores them as they are. |
| CRLF → LF on disk | "src/app.ts has CRLF on disk and will become LF the next time git writes the file" | The commit stores LF. On a checkout, branch switch or stash, the file on disk changes to LF. |
| LF → CRLF on disk | "src/app.ts has LF on disk and will become CRLF the next time git writes the file" | With core.autocrlf=true (or eol=crlf in .gitattributes), git writes CRLF to disk. The commit doesn't change. It only appears with Include LF → CRLF on. |
With several files, the warning says how many and lists up to six ("8 files go into the commit with CRLF: a.ts, b.ts, … and 2 more").
In the common Before committing dialog, in the Line endings group, along with the other findings that don't have a dialog of their own. Commit anyway goes ahead with the commit; Cancel takes you back so you can adjust.
- Click Cancel on the warning.
- Choose one of the ways out:
- for you, on this machine:
git config core.autocrlf true; - for the whole team: create a
.gitattributesat the root with* text=autoand commit it.
- for you, on this machine:
- Unstage the listed files and stage them again, so git applies the conversion.
- Commit.
Tip
A .gitattributes with * text=auto applies to everyone who clones the repository, on any system. core.autocrlf only applies to your machine.
| Option | What it does | Default |
|---|---|---|
| Line endings before committing › Warn about line endings before committing | Warns when the commit brings CRLF into the repository or when, given your settings (core.autocrlf and .gitattributes), the file's line endings will change on disk. | on |
| Include LF → CRLF (common on Windows with core.autocrlf=true) | Includes the warning about the LF → CRLF conversion on disk, which is the normal behavior with core.autocrlf=true. | off |
It only reads: the staged content and the content on disk, core.autocrlf, core.eol and each
file's .gitattributes attributes. Nothing changes.
The second warning in the group is the git version one. Versora uses the git installed on the machine, and some features need a recent git: with 2.40 or newer, everything works. With an older git, a bar at the top of the window says what's left out ("Git ‹version› found. With 2.40 or newer everything works; with this one, these are unavailable: ‹list›."), with the Download git button and the × to dismiss it.
In Preferences › Operations › Warnings › Git version, the item shows the status and has the Check again (reads the version again, after you update git) and Show the warning again (brings back the dismissed bar) buttons.
The minimum and recommended versions, the table with the git each feature needs, the bar's messages and the steps to update are in Git version.