I added lots of PNG files to a Git repository on Windows, unfortunately with the setting text eol=lf
to not commit Windows line breaks.
The problem is that the PNG header must be in the form %PNG\r\n
and now all PNG images are in Git with the header %PNG\n
and cannot be displayed like that.
I tried adding this line to .gitattributes
:
*.png binary
But the files, although correct in the working directory, still show up as unchanged and git add
does nothing.
I managed to fix single files with checking out the broken version and editing it manually but I hope there is a less tedious way.
How can I fix my repository without modifying the individual files?
I managed to solve it myself while writing down the question:
Remove all PNG files from repository but keep the working copies:
git rm --cached **/*.png
Add them again
git add **/*.png
Ready to commit!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With