I can create a repo and use GitHub / BitBucket fine for my own projects. I have had problems when collaborating with other developers or trying to fork a project on GitHub.
I am aware of other answers like Best practices for git repositories on open source projects but there are OSX / Xcode specific problems I want to know how to solve.
.DS_Store files can be a pain. You can use .gitignore to prevent, but what happens if they have already been included, or another developer adds them back in through a clumsy git command?
The .xcodeproj will have changes to the directory names and developer profiles for the other person. What's the best way to do merges or to avoid conflicts?
If I have forked or pulled from a github project, how can I clean up these issues and also minimise merge conflicts for the maintainer?
If people have an example .gitignore created for Xcode, or scripts they use to initialise their repos then that would be great!
Xcode will create your new project along with a new Git repository. All source control systems, including Git, store their data into a repository so that they can manage your project versions and keep track of changes throughout the development cycle.
Add your GitHub account to Xcode Yep, you cannot use your normal password, you need to generate a token: Go to GitHub, click on your picture > Settings > Developer settings > Personal access tokens > Generate new token: Give a consistent name to your token, like Xcode and select the scopes.
Overview. Source control is the practice of tracking and managing changes to your code. Manage your Xcode project with source control to keep a rich history of the changes you make, and collaborate on code faster and more effectively. Xcode simplifies source control management with its built-in support for Git.
Put .DS_Store
in .gitignore
. Then, if you haven't already, add .gitignore
to the repo. (You should not ignore .gitignore
.) Now all developers will ignore .DS_Store
files. If any were added to the repo erroneously before you put .DS_Store
in .gitignore
, you can now remove them (in a commit) and they should stay out.
The xcodeproj
is a directory. The only file in this directory that must be in the repository is the project.pbxproj
file. I generally ignore all of the others by putting these lines in my .gitignore
:
*.xcuserstate
project.xcworkspace/
xcuserdata/
You should avoid putting absolute paths in your build settings. Use relative paths.
Your Debug and Release builds should use iPhone Developer
as the code signing identity, so that Xcode will automatically select the local developer's profile. When you want to create an IPA (for distribution), Xcode will offer to re-sign it with a different identity, at which point you can choose your distribution profile if you need to.
If you're trying to use a project from github that has made these mistakes, you can try to get the maintainer to fix them, or you can make sure you don't touch the .DS_Store
files and the code signing identities in the same commits that you want to send upstream.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With