Solving that pesky file rename in git with APFS Volumes

I’ve been using this setup for over 2 years now and it saved me from a large number of small to medium headaches that used to haunt me every so often. Because of this, I think it’s worth talking about in a blog post.

So what am I talking about? #

Ever had to commit a file only to realise that you got the capitalisation wrong? I’ve certainly been in that situation.

Well you’d think that you could just go back, edit the filename, git commit --commit and you’re good, right? Wrong.

asciicast

Well… Wrong for most users at least, because most of them will notice that the naming change wasn’t picked up by git.

The reason why? It’s probably because you’re using a case-insensitive file system. It used to be the default option for HFS+, and it still is the default for APFS. Some applications rely on this to be the case, like the Adobe suite, so you don’t want to change case-sensitivity for your whole system drive.

Volumes to the rescue! #

APFS redefines partitions with the introduction of volumes. Normal partitions and APFS volumes differ in many ways, but the two that we care about in this case are:

So, in my case I created a new volume APFS called Projects with case-sensitive filenames and put all of my code and repositories in it.

Screenshot 2019-d06-10 at 15.53.17.png

Et Voilà! All filename changes are now getting picked up by git status.

asciicast

 
4
Kudos
 
4
Kudos

Now read this

Xcode 9 and Carthage - That pesky Coverage data

Like any other year the new Xcode GM came out and everybody started rushing to submit their apps. This year, I was also one of these early adopters. Things were going relatively smoothly, except for a weird issue with xattr when trying... Continue →