Dealing with OSX attribute files in GIT

28 November 2016

Lots of developers today love their Macs! If you…

  1. Write code
  2. Use a Mac
  3. Use git for version control


…then you likely will contaminate one of your repos with a slew of files named “Iconr” and .DS_Store at some point in your development cycle.  Often it takes people a while to realize that the Icon files aren’t actually named Iconr, but are named Icon with special carriage return characters appended to the end of them.  You’ll see them represented in a shell as Icon? or Icon\r or Icon\r\r depending on what tool you’re using.

Here is the cleanest way to prevent you from dealing with this issue across your projects.

Edit your personal global git ignore file:

vi ~/.gitignore_global

Add an entry to prevent grabbing the .DS_Store files:

.DS_Store

Add an entry to prevent grabbing the “Icon” file on any folders using custom display icons in Finder:

Icon[Ctrl+Enter]

The final result will look like this:

.DS_Store
Icon[^M]

But note that is NOT a caret-symbol and M there, so don’t just copy/paste it! Use the keystrokes above in vi/vim to create a proper carriage return character inside the brackets!

Latest Blog
18
Dec
Decoding the Cisco PCF File
Have you ever had a need to inspect the details of the Cisco VPN PCF file? Perhaps you are using OS X and you would lik..
17
Dec
Convert Cisco UCCX Prompts
We wanted to share a quick and easy method for converting sound files to proper Cisco Unified Contact Center Express (UC..