Git Error: trailing whitespace, indent SP followed by a TAB, unresolved merge conflict


I have been using Git from last few days, and faced following errors while committing:

1) Trailing whitespace
2) Indent SP followed by a TAB
3) Unresolved merge conflict

The first error “Trailing whitespace” is because of carriage-return/line-feed(windows style line feed/end). To resolve this problem comment following lines(58-60) in .git/hooks/pre-commit file:

The second one “Indent SP followed by a TAB” is because of leading spaces/tabs. To resolve this problem comment following lines(61-63) in .git/hooks/pre-commit file:

The third one “Unresolved merge conflict” is because of seven or more successive occurrence of = or < or > characters. Major chances of having seven = character in README or doc files. To resolve this problem replace following line(64) in .git/hooks/pre-commit file:

by

These tricks worked for me, I hope it could help you.

Information and Links

Join the fray by commenting, tracking what others have to say, or linking to it from your blog.


Other Posts
When Ultrasphinx is used with STI…
Rails Plugin Annotate Models For Spec And Spec Fixtures

Reader Comments

You can also just disable the commit by removing pre-commit. The hooks run by default on Windows because it has no +x bit. Removing them does no harm.

I thought git was “good”, as in “high quality”. Why should anyone need to get dirty with git guts in this manner?

Thanks a lot for posting. The whitespace error has been teasing me, but it’s still very annoying that it thinks that windows newlines are whitespace.

This doesn’t “resolve” the problem … you are just ignoring it. To really fix the problem, remove the whitespaces and tabs used as spaces as you should … and git won’t complain.

Write a Comment

Take a moment to comment and tell us what you think. Some basic HTML is allowed for formatting.