Home » Ios » Should I git ignore xcodeproject/project.pbxproj file?

Should I git ignore xcodeproject/project.pbxproj file?

Posted by: admin November 30, 2017 Leave a comment

Questions:

in a XCode project, I offen got xcodeproject/project.pbxproj file changed, but useless info for me, it for compile.

Should I git ignore this file and xcodeproject/projectxworkspace/username.xcuserdata/UserInterfaceState.xcuserstate file?

Answers:

This file holds the list of all the files in the project, settings of targets and which files belong to which targets. It’s probably the meatiest file in project bundle. You should not ignore this file. There are few points for this:

  1. You may not want to work on this project alone or;
  2. You’re planning on working on project from different machines;
  3. You’ll want to share your code base with others;
Questions:
Answers:

That is the only file that you want in your repos from the xcodeproj bundle. That file holds all of the info for targets files and build settings.

Questions:
Answers:

Unfortunately, if your Build Settings includes code signing, you have to re-enter your code-signing entity after every “git pull” if another team member has changed it. It seems to me this info should be in the user settings, not the global pbxproj file.

Questions:
Answers:

If you exclude project.pbxproj Jenkins builds will fail. So this is important if you use Jenkins.

Questions:
Answers:

I found that I also need to preserve the xcworkspace file(s). If didn’t, project with a sub-project broke.