
- #HEX FIEND CUSTOM ENCODING SOFTWARE#
- #HEX FIEND CUSTOM ENCODING CODE#
- #HEX FIEND CUSTOM ENCODING MAC#
- #HEX FIEND CUSTOM ENCODING WINDOWS#
#HEX FIEND CUSTOM ENCODING CODE#
#HEX FIEND CUSTOM ENCODING SOFTWARE#
Now I can commit and push “CodeFile.swift” to Git and see an accurate representation of the changes I made.Ī lot of configuration files in the software development world are stored in XML, and rightly so, as XML is a very readable format. Now look what happens when I do a git diff:
#HEX FIEND CUSTOM ENCODING WINDOWS#
I used a reliable text editor, TextWrangler, to save “CodeFile.swift” with Windows line endings ( CRLF): Here’s “CodeFile.swift” after I made changes:
#HEX FIEND CUSTOM ENCODING MAC#
Can you guess what happened when I made some changes and I saved the file? It was saved into Mac format ( LF): Note that file “CodeFile.swift” was saved in Windows format ( CRLF). Whenever I pull a file from my remote, and before making changes to code and saving the file, I look at the file in the hex editor. I don’t want to get involved in a long-winded discussion of Git here I just want to point out the usefulness of Xcode’s hex editor - despite Xcode’s other problems. Git is hard enough to understand and configure properly, but having Xcode jump into the line ending quagmire is a royal pain in the ars. Reported to Apple and bugreport marked as duplicate, so they know it already. My Preferences->Text Editing is set to CLRF (Original line breaks) and yet it changes everything to LF. Since I upgraded to Xcode 9 every time I change even one character in the code, whole file gets its line breaks changed (I checked with xxd) and so it looks like I modified the whole file. I discussed this in my Git tutorial and there’s lots of information on the web for configuring Git. Git has settings to compensate for, and thus allow us to compare, files with different line endings. When you want to go to the next line while coding, you hit the Enter key on Windows and the return key on Mac. OS X uses one, a “line feed,” LF (hex 0A).



Xcode is screwing up my file line endings (Git)Īs I discussed in my aforementioned Git tutorial, Windows uses two invisible characters to mark the end of a line, a “carriage return” and a “line feed,” CR LF (hex 0D 0A). Read one of my Git tutorials, “Typical Git/GitHub workflow tutorial: configure, clone, commit, stage, push, pull, status,” specifically the section on “Git handling of line endings.” Other members of my team write code on OS X using Xcode. Some members of my teams develop code on Windows using Visual Studio. I work in a mixed development environment. Would anyone like to speculate as to why I’m looking at the sequence 0D 0A? I’ll give you a hint. I checked the next two consecutive hex characters, 0D 0A: Notice that the corresponding human-readable characters are highlighted on the right. Notice that I’ve highlighted the two consecutive hex characters, 0D 0A, on the left, in the hex editor screenshot above.
