One Rule: Pause First
You MUST pause CodeKit's file-watching before you perform any version control action that changes large numbers of files at once. (Switching branches, rebasing, pulling, etc.)
CodeKit 3.4+ will automatically pause file-watching when any version-control app becomes active. Optionally, you can also make this happen when the Terminal becomes active. To do that, choose CodeKit > Preferences from the menubar and check the appropriate box.
To do this, press command + option + control + /. This global keyboard shortcut works in any app and toggles CodeKit's file-watching. (Tip: it's the three keys to the left of the space bar, plus a forward slash like you're typing a // comment.)
You can also choose File > Pause File-Watching from the menubar. Either way, you'll see the purple bar pictured above.
Alternately, to ignore file changes in a single project only, un-check that project in the list.
Because when Git changes lots of files at once, CodeKit attempts to process them but finds that the filesystem is mutating underneath it. Files CodeKit expected to find are suddenly missing, or change right in the middle of compiling. This can, in the worst case, cause a crash.
What If I Forget?
Most likely, files in your project will appear to randomly change their settings. It happens because of this sequence:
- You have a file named main.js in your project. You've customized some settings (or an output path) for that file.
- You start a pull or branch switch in Git.
- Git sees that main.js has some differences.
- Git deletes the old main.js file.
- CodeKit sees the delete event and says, "Okay, this file's gone. We can forget its settings and output path."
- Git creates a new file named main.js with the different content.
- Boom: main.js appears to have magically "warped" back to default settings.
Pausing CodeKit's file-watching before performing a Git action ensures that the app doesn't respond to these "fake" delete events.
I Switched Branches & My Settings Changed!
Well, yea! The other branch had a different config.codekit3 file. When you un-paused CodeKit after switching branches, the app read that new settings file and immediately applied those settings.
That's how it's supposed to work. This way, for example, you could have a "debug" branch where you set ESLint to ignore console() calls and then a "release" branch where ESLint will warn about those calls. Or, you might choose not to minify your scripts on one branch, etc.
Note: The way to avoid this issue is to configure your Project Settings BEFORE you start the project. (See Settings Defaults For New Projects.) If you configure options at the start instead of as you work, your branches generally shouldn't have different settings.
Why Can't You Tell Git is Changing Stuff?
Security. Unix generally doesn't allow one process (app) to see what other processes are doing without superuser privileges.
Is There a Funnier Version Of This Page?
Yes. I once wrote a blog post for the folks that make Tower. Unfortunately, they edited out the bit about punching a Kardashian. But the rest is still pretty humorous.