When using git on Mac OSX and your project’s folder has a custom icon, you will see a “Iconr” File showing up in your git status or Source Tree. Ignoring this file doesn’t work.
The solution is to ignore the correct way (or syntax), because Apple uses ^M at the end of the filename, which is a CRLF, a hidden character. In fact you have to ignore “Icon^M^M” in your .gitignore file, but it’s not easy to enter these special characters as ^M is in fact one single CRLF character.
I found a hint using the ruby interactive interpreter, but i wanted to use my beloved Python, so here’s the code:
>>> f = open('.gitignore','a') >>> f.write('Icon\r\r') >>> f.close()
use this in your home directory as you need to edit ~/.gitignore and ~/.gitignore_global (for Source Tree)