I think that for the use case you presented the git core.autocrlf config option is more appropriate.
With this option each developer can work with their native eol character.
However what I like about your option is that you can commit the gitattribute file and force the change for every developers
You're not really forcing it if you need to ask everyone to flush their cache / reset gitattributes.
If you need cooperation, it's better to just ask developers to set their autocrlf setting properly.
Prettier issue aside, it's better to preempt accidental commits of eol changes anyway.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I think that for the use case you presented the git core.autocrlf config option is more appropriate.
With this option each developer can work with their native eol character.
However what I like about your option is that you can commit the gitattribute file and force the change for every developers
Thanks for the tip.
You're not really forcing it if you need to ask everyone to flush their cache / reset gitattributes.
If you need cooperation, it's better to just ask developers to set their autocrlf setting properly.
Prettier issue aside, it's better to preempt accidental commits of eol changes anyway.