Protip: On Linux, if you rename a file, changing only the case of the file name somehow, e.g.,
main.layout.js → Main.layout.js,
Git will pick up the change immediately.
On macOS, because it Just Works™ and you’re holding it wrong, you have to manually tell it:
git mv main.layout.js Main.layout.js
@aral Making two files the same name with different cased letters used to be a preferred method of Linux users trolling Windows users.
@aral Also, Linux not respecting file extensions as a magical thing was definitely weird for me on day 1 of Linux. "You mean renaming it to exe or com doesn't make it executable?! What the heck it chmod?"
And sometimes the extension lies, which is why the `file` command is awesome.
@aral I could be wrong but I think that may depend on your system volume format. I ran into this a couple years ago and realized there is a case-sensitive APFS option which is not used by default. I’d be curious if that changes the behaviour.
@greatislander Yeah, this is just the default behaviour.
@greatislander @aral I enabled this on a MacBook I had and it was not a lovely experience. Some pretty high profile stuff like Creative Cloud would just not work at all.
@aral I remember the fun days with Subversion, where the repo was shared by both Linux and Windows users…
@aral Unless you have your filesystem in case-sensitive mode (which also makes it so you can't install most Adobe Software, ask me how I know).
But I didn't know about `git mv` -- that is very useful!
@aral hmmm, theoretically I *think* you want “APFS (Case-sensitive, Encrypted)” (for 10.13 and later) or “Mac OS Extended (Case-sensitive, Journaled, Encrypted)” for 10.12 and earlier to get that.
for details & choices see also: https://support.apple.com/guide/disk-utility/file-system-formats-dsku19ed921c/mac
@aral okay, confirmed...
I mounted a drive I knew was *not* formatted as per Apple default, but instead as Case-sensitive, and here are the test results:
@aral Some parts of git-on-osx experience feel like decisions made out of sheer spite for non-linux users. Like insisting on mac-style argument order (flags before positional arguments, not after) even though it’s more flexible on linux and a lot of other tools somehow manage to be more flexible on macos, too.
@aral macOS is not case sensitive, it only appears to be
@aral same with coding in R: having capitalisation errors while using source() do not matter in osx, it does on a linux machine.
I learned the hard way...
@aral you can use git config core.ignorecase false to always have git on Mac OS pick up the changes. Hope it helps :)
@aral If you are working with git on a Mac, sharing repos with other platforms, your life will be far better if you make yourself a case sensitive sparsebundle and work in that. https://coderwall.com/p/mgi8ja/case-sensitive-git-in-mac-os-x-like-a-pro & https://stackoverflow.com/a/12085233/1124740 has made my life easier for a decade without worrying about autcrlf or safecrlf.
Exclude it from Time Machine backups too because what's the point of backing up a git repo & build artifacts if you push to a remote regularly? (1/2)
@aral only if you’ve selected a case-insensitive file system?
@holdenweb It’s a Mac; for 99.99999% of people, Apple selects it for you.