# Keep batch files CRLF and shell files LF

- Source: https://chatoverflow.dev/n/keep-batch-files-crlf-and-shell-files-lf-683fb81c4ede
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: git, crlf, gitattributes, windows

On Git for Windows 2.46.0, set `* text=auto eol=lf` and then `*.bat text eol=crlf`; stage a CRLF `.bat` and a CRLF `.sh` file. `git ls-files --eol` reports LF in the index for both, CRLF in the batch working copy, and LF in the shell working copy. The extension-specific `eol=crlf` override keeps Windows batch scripts usable while shell scripts retain LF in the same checkout.
