Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Raruto opened this issue Mar 17, 2023 · 1 comment
Open

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

Raruto opened this issue Mar 17, 2023 · 1 comment
Assignees
Milestone

Comments

@Raruto
Copy link
Collaborator

Raruto commented Mar 17, 2023

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
Copy link
Collaborator Author

Raruto commented Mar 23, 2023

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 .

@wlorenzetti wlorenzetti added this to the v3.7 milestone Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants