Reputation: 175
I'm new to Xcode and just found out that it stores a bunch of user information and other stuff in the project directory that I don't really need in version control or want to put up on Github. This is what an Xcode project basically 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 inclination is to just commit the AppName/
and AppNameTests/
and exclude the AppName.xcodeproj/
directory. What's the recommended way of doing this?
Upvotes: 14
Views: 5067
Reputation: 54623
The "recommended way" really depends on what you want to do with the project. Typically, there are three choices:
With the last, you can get into problems with timestamps (while git can be told to know something about commit-times — see Checking out old file WITH original create/modified timestamps — few people do it). Without a system that retrieves files using their original timestamps, you end up with a set of files that demand recompilation each time you do a commit.
Even saving the customization files can be problematic, if you move the files to another part of the filesystem (or attempt to share the files with others).
So... use .gitignore
to filter out files not needed to build. But check that you can successfully build using a fresh checkout.
Upvotes: 0
Reputation: 22513
A better question is what should go in my git ignore file. This is a link to the github repo containing the file you need
https://github.com/github/gitignore/blob/master/Global/Xcode.gitignore
Make sure u start with this file so the files are properly ignored because if you don't some files my be added already and you will have to manually remove them.
Upvotes: 1
Reputation: 89569
You'll want to use a .gitignore
file to specify which files you don't want to store in GitHub.
Here is how to create the file, and here's what should go in that .gitignore
file.
Upvotes: 1