Should I git ignore xcodeproject/project.pbxproj file?
Solution 1:
Update in the light of Swift Package Manager: If you're building a project as a Swift package - you should definitely ignore this file as it can be generated using file system as source of truth. You can do that by using the following command:
$ cd ~/Projects/MyProjectFolder/
$ swift package generate-xcodeproj
For non-SwiftPM answer - see below.
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:
- You may not want to work on this project alone or;
- You're planning on working on project from different machines;
- You'll want to share your code base with others;
Solution 2:
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.
Solution 3:
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.
Solution 4:
If you exclude project.pbxproj Jenkins builds will fail. So this is important if you use Jenkins.
Solution 5:
project.pbxproj is an important file in the Xcode configuration bundle. It is responsible for maintaining references to all of the linked files and their groupings, linked frameworks, and most importantly, the project’s build settings. Because of this, we cannot exclude project.pbxproj from version control.
Here is my general .gitignore
for my Xcode Project.
# OS X Finder
.DS_Store
# Xcode per-user config
*.mode1
*.mode1v3
*.mode2v3
*.perspective
*.perspectivev3
*.pbxuser
*.xcworkspace
xcuserdata
# Build products
build/
*.o
*.LinkFileList
*.hmap
# Automatic backup files
*~.nib/
*.swp
*~
*.dat
*.dep