I'm trying to use Git and GitHub to sync a number of app configuration files. These are XML or plist files stored in a binary format. For example, a Keyboard Maestro .kmsync file.
I can open these files via a text editor to see an XML format.
But when I view these file diffs in a GitHub Pull Request, commit view, etc. I see a useless binary diff with no visible changes:
Showing with 0 additions and 0 deletions.
BIN +17 Bytes (100%)
Binary file not shown.
I can get the a text-based diff to display locally via git via a .gitattributes file. However, it appears that GitHub doesn't respect these modifications:
GitHub doesn't use .gitattributes files for choosing which files to show in a diff, so it's not possible to get around this that way. [source]
I want to see the text-based changes and line diffs when I view these files on GitHub in my commits and Pull Requests.
For example, the GitHub PR here. Feel free to fork and experiment:
https://github.com/pkamb/so/pull/1
How can I convince the web view of a GitHub repo to use text-based diffing for certain "binary" files?
I cannot find an existing question for my specific ask (displaying a non-binary diff on GitHub).
The following questions relate to for this same behavior, but for local git (not GitHub).
- Override git's choice of binary file to text
- How would you put an AppleScript script under version control?
My question is the opposite of this question, which seeks to display text files as binary files on GitHub:
.kmsyncfile(s) in your repository and also a link to your.gitattributesfile? That would make the problem easier to reproduce and less theoretical. I do not think it is a good idea to expect all people viewing your question (42 already at the time of writing this) to each create a sample repository, trying to replicate your situation..kmsyncfile is a binary file! I thought it is an XML file accidentally treated as a binary. You said you can open that file in a text editor and see XML. That is impossible, unless your editor knows how to expand the binary format. How would GitHub know that? Please explain. I think you are asking a bit too much there. A.gitattributesfile cannot make a binary file magically into a text file, only tell Git which files to treat as binary or text, in case it does not do the right thing automatically. This does not work locally in Git, so why would it work on GitHub?plutil -convertas mentioned in the thread you linked to. My editors here on Windows and my IDE definitely cannot open it.