First of all, I'm not asking what does it mean or how to change it. The thing what interest me most is: how can I see what's already in repo? What type of line endings.
I have my repositories on github and bitbucket.
Thanks for help
This is a good default option. text eol=crlf Git will always convert line endings to CRLF on checkout. You should use this for files that must keep CRLF endings, even on OSX or Linux. text eol=lf Git will always convert line endings to LF on checkout.
Try file -k Short version: file -k somefile. txt will tell you. It will output with CRLF line endings for DOS/Windows line endings. It will output with CR line endings for MAC line endings.
Git doesn't expect you to use unix-style LF under Windows. The warning "CRLF will be replaced by LF" says that you (having autocrlf = input ) will lose your windows-style CRLF after a commit-checkout cycle (it will be replaced by unix-style LF). Don't use input under Windows.
Git does not store "neutralized lines". So yes, Git can save files with mixed line endings, but that's usually a bad practice to avoid.
To tell what line endings a file in the repository is using, use git show
to extract the file's contents. This will give you the contents without changing the line endings.
If you were to look at the files in your local working directory, as in one of the other answers, that only tells you what line endings are in the checked out working directory. Git can, and on Windows usually will, change the line endings when files are checked out and reverse the change when they are committed. So you will see CR-LF in the working directory even though the data in the repository uses LF.
Using git show
or git cat-file -p
will bypass this conversion.
The output of git show can be piped to file to have it automatically detect the line ending type. E.x.:
git show HEAD:file.c | file -
/dev/stdin: ASCII text, with CRLF line terminators
You can change the revision from HEAD
to something else to see what the line endings were on an older revision. For instance to see if they have changed.
You can use this command:
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.
Download the repository source code as a .zip
file. Use Notepad++ to check the files after enabling:
View->Show Symbol->Show End Of Line setting
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With