rogerxu / git-tips

Tips for Git
Apache License 2.0
2 stars 3 forks source link

Line Endings in Git #30

Open rogerxu opened 7 years ago

rogerxu commented 7 years ago

Dealing with line endings - User Documentation

rogerxu commented 7 years ago

Mind the End of Your Line ∙ Adaptive Patchwork

rogerxu commented 7 years ago

Git - gitattributes Documentation

# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto eol=lf

# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.h text

# Declare files that will always have LF line endings on checkout.
*.sh text eol=lf

# Declare files that will always have CRLF line endings on checkout.
*.bat text eol=crlf
*.ini text eol=crlf

# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
*.gif binary
*.bmp binary
*.ico binary
*.pdf binary