Permalink
Browse files

.gitattributes: Add a comment explaining what `* text=auto` does

  • Loading branch information...
mathiasbynens committed Feb 14, 2012
1 parent b8602fe commit 5680325e8fd364e30e4a9b7bbc27c4b28cdfd56d
Showing with 1 addition and 0 deletions.
  1. +1 −0 .gitattributes
View
@@ -1 +1,2 @@
+# Automatically normalize line endings for all text-based files
* text=auto

6 comments on commit 5680325

@davidhund

This comment has been minimized.

Show comment
Hide comment
@davidhund

davidhund Jun 7, 2012

This auto line ending conversion possibly 'dirties' the working tree.

In my case: a git status (on a newly cloned project with some submodules etc.) results in the following warnings: warning: CRLF will be replaced by LF in foor\bar.ext

It might be nice mentioning this.

What is the best way dealing with this? Should I just git config core.autocrlf true to disable these warnings?

Update Only now discovering https://help.github.com/articles/dealing-with-line-endings Guessing the best way to deal with this is "Re-normalizing a repo" as described there?

This auto line ending conversion possibly 'dirties' the working tree.

In my case: a git status (on a newly cloned project with some submodules etc.) results in the following warnings: warning: CRLF will be replaced by LF in foor\bar.ext

It might be nice mentioning this.

What is the best way dealing with this? Should I just git config core.autocrlf true to disable these warnings?

Update Only now discovering https://help.github.com/articles/dealing-with-line-endings Guessing the best way to deal with this is "Re-normalizing a repo" as described there?

@mathiasbynens

This comment has been minimized.

Show comment
Hide comment
@mathiasbynens

mathiasbynens Jun 7, 2012

Owner

I usually temporarily rename the ~/.gitattributes in such cases (e.g. when working on ). Not sure if there are better ways to do it to be honest…

Owner

mathiasbynens replied Jun 7, 2012

I usually temporarily rename the ~/.gitattributes in such cases (e.g. when working on ). Not sure if there are better ways to do it to be honest…

@sindresorhus

This comment has been minimized.

Show comment
Hide comment
@sindresorhus

sindresorhus Jun 7, 2012

Contributor

I think you can use the .git/info/attributes file to override the global attributes (if it doesn't exist you need to create it). Using this file will let you add attributes to a repo without having to check it in ;)

Contributor

sindresorhus replied Jun 7, 2012

I think you can use the .git/info/attributes file to override the global attributes (if it doesn't exist you need to create it). Using this file will let you add attributes to a repo without having to check it in ;)

@mathiasbynens

This comment has been minimized.

Show comment
Hide comment
@mathiasbynens

mathiasbynens Jun 7, 2012

Owner

Woah, that’s truly a ProTip™! Thanks, @sindresorhus!

Owner

mathiasbynens replied Jun 7, 2012

Woah, that’s truly a ProTip™! Thanks, @sindresorhus!

@sindresorhus

This comment has been minimized.

Show comment
Hide comment
@sindresorhus

sindresorhus Jun 7, 2012

Contributor

Sure ;)

More info here: http://git-scm.com/book/ch7-2.html

Contributor

sindresorhus replied Jun 7, 2012

Sure ;)

More info here: http://git-scm.com/book/ch7-2.html

@davidhund

This comment has been minimized.

Show comment
Hide comment
@davidhund

davidhund Jun 7, 2012

I've followed the Github tip and completely wiped out my working tree (which is a hassle). So next time I'll also just tmp override the .git/info/attributes Great tips, thanks!

I've followed the Github tip and completely wiped out my working tree (which is a hassle). So next time I'll also just tmp override the .git/info/attributes Great tips, thanks!

Please sign in to comment.