g3w-suite / g3w-suite-documentation

Edit and translate G3W-SUITE end-user documentation
https://g3w-suite.readthedocs.io/
1 stars 8 forks source link

How to convert all files from `CRLF` to `LF` (windows users) #15

Open Raruto opened 1 year ago

Raruto commented 1 year ago

This is a really annoying issue because the .gitattributes actually works fine (but some local older files or branches may still have a different encoding..).

  1. If I remember correctly it can all be done via git commands (ie. listing all local CRLF files and convert all of them to LF), If I only could remember how..
  2. Add this info somewhere in the documentation (e.g. dedicated FAQ section)
Raruto commented 1 year ago

How to see what type of line endings are already in git repository?

git ls-files --eol

It will output one line per file with the following information:

i/lf    w/crlf  attr/text=auto eol=lf   file.txt

In that example, i/lf means that the file uses lf in the index, and w/crlf means it uses crlf in the working directory.


How to normalize working tree line endings in Git?

With Git client 2.16 and higher:

git add --renormalize .