0

On Windows 10, IDE is Visual Studio Code

I am working with a Ts.Ed node environment for work. We have a repository that is originally written with LF line breaks. As a Windows user, my IDE converts all of my files to CRLF. I have to manually convert all files to LF if I want to keep consistent.

One of our repositories with the above setting is not allowing me to commit because of this Husky error (as displayed here in Stack Overflow. After following the instructions in the Stack Overflow link to fix it, it finally lets me commit my work, however it commits almost every other file in the system that I haven't touched but have decided to commit itself in git because of the LF-> CRLF change.

Is there a way I can prevent this from happening without having to manually convert all files to LF?

Mika
  • 11
  • 2
  • Consider adding `* text eol=crlf` to your `.git/info/attributes`. Note that this is a Really Big Hammer and you might want to trim it down to, say, `*.cc` and `*.hpp` or some such, or add exceptions like `*.jpg binary`. The `eol=crlf` tells Git that *Git* should change LF-only to CRLF "on the way out" of Git, and CRLF to LF-only "on the way in". – torek May 26 '22 at 06:08
  • The problem here is that this damages binary files, but if there are no binary files in the repository, there's nothing to damage. Putting this in your `.git/info/attributes` means it's a private setting just for you, rather than a setting that applies to everyone. – torek May 26 '22 at 06:10

0 Answers0