I've read the Git Pro website and I've read multiple answers on StackOverflow, but sadly I am simply unable to make .gitattributes work for me.
Whenever I'm using git difftool
, it will attempt to display the difference between binary files, such as image files (PNG).
I have tried a variety of combinations in my .gitattributes file, but whenever I run my git difftool
command, it still attempt to compare the binary files.
In my repository's folder, I have:
.git
.gitattributes
[my project's files subdirectories]
I have tried many combinations of filters for my .gitattributes file. For example:
*.pbxproj binary
*.png binary
Or also:
*.pbxproj binary -diff
*.png binary -diff
Even:
*.pbxproj binary
*.png binary
*.pbxproj -diff -difftool
*.png -diff -difftool
Every time, I simply add my .gitattributes file to the index and commit it. However, after doing so, when I run my git difftool
to examine my differences between two branches, this happens:
git difftool otherBranch HEAD
Viewing: 'MyApp.xcodeproj/project.pbxproj' Hit return to launch 'diffmerge':
Viewing: 'MyApp/Background1.png' Hit return to launch 'diffmerge':
How come it's doing this? How can I finally set my .gitattributes file properly so I do not have to view the diffs for these specific files?
To further investigate, I have used the git check-attr
command as follows:
git check-attr binary MyApp/MainBackground.png
The output is MyApp/MainBackground.png: binary: set
... I wonder why git difftool still forces me to view the diff!