Git on Mac OS X: Don't ignore case!

Posted by: Howard Lewis Ship on 07/28/2010

By default, Mac OS X uses a case insensitive file system, and Git seems to honor that. The problem is, most programming languages, especially Java, are case sensitive. Class "JavaScriptSupport" needs to be in file "JavaScriptSupport.java" and not "JavascriptSupport.java". This is even worse when sharing code via a repository since some other developers may check out code on a case sensitive file system.

I was just renaming some classes, from things like "JavascriptStack" to "JavaScriptStack" (because the language is called "JavaScript" not "Javascript") ... and I was dismayed that Git saw that as an in-place update to a file, not a rename of the file.

Unfortunately, it's not as simple as git config core.ignorecase false to make Git do the right thing. That's an essential part of it, but Git still sees changes to the original naming of the file as a change, not a deletion.

I had to use the trick of one commit renaming JavascriptStack.java --> JSStack.java, then a second commit renaming JSStack.java --> JavaScriptStack.java.


About Howard Lewis Ship

Howard Lewis Ship

Howard Lewis Ship is the creator and lead developer for the Apache Tapestry project, and is a noted expert on Java framework design and developer productivity. He has over twenty years of full-time software development under his belt, with over ten years of Java. He cut his teeth writing customer support software for Stratus Computer, but eventually traded PL/1 for Objective-C and NeXTSTEP before settling into Java.

Howard is respected in the Java community as an expert on web application development, dependency injection, Java meta-programming, and developer productivity. He is a frequent speaker at JavaOne, NoFluffJustStuff, ApacheCon and other conferences, and the author of "Tapestry in Action" for Manning (covering Tapestry 3.0). Lately, he's been dipping his toes into alternate languages, including Clojure.

Howard is an independent consultant, offering Tapestry training, mentoring and project work as well as training in Clojure. He lives in Portland, Oregon with his wife Suzanne, and his son, Jacob.

More About Howard »

NFJS, the Magazine

December Issue Now Available
  • BDD and REST

    by Brian Sletten
  • Mocks and Stubs in Groovy Tests

    by Kenneth Kousen
  • Algorithms for Better Text Search Results

    by John Griffin
  • Knowns and Unknowns of Scrum and Agile

    by Brian Tarbox
Learn More »