Skip to content

dos2unix as ^M solution in Git pre-commit hook

Apparently this problem is well known and common
solution is to comment out next lines in the
.git/hooks/pre-commit file.

p.two{border-style: solid;border-width: thin}p.name {background-color: rgb(240,240,2

1 if (/\\s$/)
2 {
3 bad_line(trailing whitespace, $_);
4 }

I personally don’t like this approach; instead i will follow
make your compiler happy” advice. Small unix utility dos2unix was created to solve exactly this type
of problems. All i need to do is to add this utility to pre-commit hook and I hope it will do the magic.