What Xcode project files should be kept in version control?

I am new to Xcode and only found out that it stores a ton of information about users and other materials in a project directory that I really don't need in version control or do not want to put up with Github. Here's what the Xcode project looks like:

1 AppName/ 2 โ”œโ”€โ”€ AppName 3 โ”‚  โ”œโ”€โ”€ Base.lproj 4 โ”‚  โ”‚  โ”œโ”€โ”€ LaunchScreen.xib 5 โ”‚  โ”‚  โ””โ”€โ”€ Main.storyboard 6 โ”‚  โ”œโ”€โ”€ Images.xcassets 7 โ”‚  โ”‚  โ””โ”€โ”€ AppIcon.appiconset 8 โ”‚  โ”‚  โ””โ”€โ”€ Contents.json 9 โ”‚  โ”œโ”€โ”€ AppDelegate.swift 10 โ”‚  โ”œโ”€โ”€ Info.plist 11 โ”‚  โ””โ”€โ”€ ViewController.swift 12 โ”œโ”€โ”€ AppName.xcodeproj 13 โ”‚  โ”œโ”€โ”€ project.xcworkspace 14 โ”‚  โ”‚  โ”œโ”€โ”€ xcuserdata 15 โ”‚  โ”‚  โ”‚  โ””โ”€โ”€ user1.xcuserdatad 16 โ”‚  โ”‚  โ”‚  โ””โ”€โ”€ UserInterfaceState.xcuserstate 17 โ”‚  โ”‚  โ””โ”€โ”€ contents.xcworkspacedata 18 โ”‚  โ”œโ”€โ”€ xcuserdata 19 โ”‚  โ”‚  โ””โ”€โ”€ user1.xcuserdatad 20 โ”‚  โ”‚  โ””โ”€โ”€ xcschemes 21 โ”‚  โ”‚  โ”œโ”€โ”€ AppName.xcscheme 22 โ”‚  โ”‚  โ””โ”€โ”€ xcschememanagement.plist 23 โ”‚  โ””โ”€โ”€ project.pbxproj 24 โ””โ”€โ”€ AppNameTests 25 โ”œโ”€โ”€ AppNameTests.swift 26 โ””โ”€โ”€ Info.plist 

My tilt is to just commit AppName/ and AppNameTests/ and exclude the AppName.xcodeproj/ directory. What is the recommended way to do this?

+6
source share
3 answers

You want to use the .gitignore file to indicate which files you donโ€™t want to be stored on GitHub.

Here's how to create a file , and here's what should happen in this .gitignore file .

+1
source

A better question is what should happen in my git ignore file. This is a link to the github repository containing the file you need

https://github.com/github/gitignore/blob/master/Global/Xcode.gitignore

Please note that u start with this file so that the files are correctly ignored, because if you do not have some files, I must be added already, and you will have to manually delete them.

0
source

The โ€œRecommended Wayโ€ really depends on what you want to do with the project. Typically, there are three options:

  • checking only those files that are necessary to create a project
  • Add files that reflect development settings (such as project files that store the names of currently displayed files in editors).
  • generated files to take a complete snapshot of the status of the project.

With the latter, you may run into problems with timestamps (while git might be told to learn something about commit-times - see Checking the old file WITH original create / modified timestamps , few do). Without a system that retrieves files using their original timestamps, you end up with a set of files that require recompilation every time you commit.

Even saving settings files can be problematic if you move files to another part of the file system (or try to share files with others). A.

So ... use .gitignore to filter out files that are not needed for assembly. But check that you can successfully build using the new check.

0
source

All Articles