What shows as "Iconr" in SourceTree is really Icon\r
where \r
is the hex value 0x0d
.
The .gitignore filename pattern matching is limited when compared to POSIX regex. Regular expression patterns such as Icon\r
and Icon\x0d
did not work for me with SourceTree.
Simple Ignore: Adding Icon?
pattern in the .gitignore file will work to have "Iconr" files ignored in SourceTree.
Caveat: Icon?
uses ?
which is a single character wildcard. So, files and folders like Icon\r
, "icona", "icon3" and "Icons" will be ignored with an Icon?
pattern. If needed, use file names "Icon01", "icon02", "iconaa" instead of "Icon1", "icon2", "icona" with this workaround to add such files to git.
Precise Ignore: The precise Icon\r
filename can be ignored with a binhex editor.
In binhex editor, add 0a 49 63 6f 6e 0d 0d 0a
in the .gitignore file. The extra 0a
s are linefeeds to bracket the Icon\r\r
for later editing of an otherwise unix file.
Caveat: If using the precise value 49 63 6f 6e 0d
, be careful to not replace \r
with \n
. In other words, do not edit .gitignore in a text editor set to auto-replace line separators with this approach.
Note: The Simple Ignore Icon?
is convenient and sufficient for most use cases. Quit and restart SourceTree to see the changes take effect. macOS's git is case-insensitive by default.
Custom Folder/File Icons: An Icon\r
file is created each time a custom icon is added to a folder or file. For example, the custom icon can be added via the "Get Info" window. Here is an example where the default system folder icon has been replaced with a custom folder icon:

The Icon\r
file(s) can be removed manually via the file's/folder's "Get Info" window or by invoking a shell command to remove the Icon\r
files, as noted in kenorb's answer.