The end of the Git Line Ending Story?
Git wants to help you handle line endings in text files (which are different on different platforms) so your code can be easily shared across platforms. To be able to help you with this git needs to know what you consider to be text files (and which files you consider to be binary). You do that by adding a .gitattributes
file in the repository (alongside the .git
folder). The .gitattributes
file should at least contain the line * text=auto
(the lazy way) which let’s git determine which file are text. However adding a line like:
*.txt text
or
*.jpg binary
for each text file type is the most declarative/precise way to tell git which files are text and which files are binary.
An alternative starting point for a .gitattributes
file is the one github for windows application creates for you. It looks like this:
If you read only one more thing about this I think you should make it this stackoverflow answer.
Other references: .gitattribute documention https://help.github.com/articles/dealing-with-line-endings#per-repository-settings https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html#_end_of_line_conversion git line ending history (and why it matters) http://adaptivepatchwork.com/2012/03/01/mind-the-end-of-your-line/