Campa
Campa

Reputation: 4495

Git showing non-existent carriage-returns

I am working on a FOSS project and I have my nice local git repo. Recently it happens sometimes that I submit a patch and it cannot be applied:

error: foo.xml: patch does not apply
Did you hand edit your patch?
It does not apply to blobs recorded in its index.
Cannot fall back to three-way merge.

and when this happens it's always due to files which add carriage-returns.

I look into the git-diff and I see those (damned) carriage-returns ^M that I see at the end of the lines.

They shouldn't be there, I don't use Windows either, and vim only sees normal newlines \n. It feels like a kind of poltergeist, and I am getting scared.

Any clue?

Upvotes: 0

Views: 174

Answers (1)

Mahesh Salaria
Mahesh Salaria

Reputation: 180

Use:

$git am -3 --ignore-whitespace /c/temp/git/format_since_origin.patch

Check this complete thread for more help: Error while applying a patch in git

Upvotes: 1

Related Questions