Git configuration for cross-platform code


I’ve got a PC desktop and a Mac laptop, and I’m looking to build things that can work on either. Ideally I’d like to be able to use git to push on one and pull on the other, but the tooling is vastly different- Visual Studio for PC, XCode for Mac. They require different configurations, and separate files, and the directory layout seems a little different. Does anyone have any experience with this?

My current thinking is this:

  • Use the project generator on both to create a folder
  • Create a git configuration that only looks at the ‘src’ folder and the ‘data’ directory of the ‘bin’ folder
  • Configure the specifics of any compilation separately

Is this a good approach, or is there a better way? Should I just add all the files, or will there be some sort of clash? I may add in Linux too at some point for kicks, so any tips appreciated.


I’ve done this a lot in the past for OSX / Windows – you can use the project generator on either side to generate the project files and since these don’t conflict you can have them live in the same folder (ie, xcodproj and vcproject files side by side). I use a good .gitignore (see below) but I do commit all project files in case I need to build the project on a new machine:


Fantastic, thanks!