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
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
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.
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.
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