Skip to content
Browse files

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

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

6 comments on commit 5680325

@davidhund

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
Owner

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

@sindresorhus

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
Owner

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

@davidhund

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.
Something went wrong with that request. Please try again.