How do you keep Xcode project source files in sync with your file system directories? How do you keep Xcode project source files in sync with your file system directories? xcode xcode

How do you keep Xcode project source files in sync with your file system directories?


Other answers notwithstanding, this is absolutely a departure from other IDEs, and a major nuisance. There's no good solution I know of.

The one trick I use a lot to make it a little more bearable — especially with resource directories with lots of files in them — is:

  • select a directory in the project tree,
  • hit the delete key,
  • choose "Remove References Only", then
  • drag the directory into the project to re-add it.

This clobbers any manual reordering of files, but it does at least make syncing an O(1) operation, instead of being O(n) in the number of files changed.


I'm intrigued which IDEs you're using that automatically compile everything in a directory, as no IDE I've ever used does that (at least for C++). I think it's pretty standard to have a project file containing a list of all the files. Often you may want to only include certain files for different targets, have per-file compiler settings, etc.

Anyway, given that that's how it does work, you really shouldn't have too many problems from merge conflicts. The best advice would be commit early and often so that you don't get out of step with other people's changes. Merely adding files to the project shouldn't result in a conflict unless they happen to be added at exactly the same point in the project tree. We've been using Xcode in our team for years and we very rarely get conflicts: only if someone has restructured the project.

Fortunately, because the Xcode file format is text, it's generally quite easy to resolve conflicts when they occur, unlike the Bad Old Days of Codewarrior with it's binary format.