I am new to using git and I followed some instructions for using it directly form the terminal. I noticed when I opened the project that Xcode also showed this repository clearly, even though it was an existing project and Xcode did not itself create the repository (I didn't have that option checked when the project was created).
I read on this question that Xcode keeps its repositories separate from the repository created using git manually from terminal. Yet, my experience suggests Xcode is in fact finding it fine.
My questions are simply:
Does it matter from the sake of functionality whether the repository is created with Xcode or manually from the terminal?
Can the two be used interchangeably on the same project? Will the same repository be used?
Is perhaps the latest Xcode 4.6 and improvement in this area and this is why the above-linked question suggested problems that I am not encountering?
I read on this question that Xcode keeps its repositories separate from the repository created using git manually from terminal. Yet, my experience suggests Xcode is in fact finding it fine.
You are right, it is fine (at least for what I use it for).
Does it matter from the sake of functionality whether the repository is created with Xcode or manually from the terminal?
No, it doesn't.
Can the two be used interchangeably on the same project? Will the same repository be used?
Yes and yes.
Is perhaps the latest Xcode 4.6 and improvement in this area and this is why the above-linked question suggested problems that I am not encountering?
Likely, although at least with Xcode 4.5 it worked for me as well.
Related
Since Apple has pulled subversion integration from Xcode (and Perforce never choose to directly support that integration since Xcode 3), it seems as if git is the only fully integrated source code control system for MacOS and IOS development.
How well does Xcode 10.x integration work with GitHub?
In addition to Xcode's integration, what are some polished MacOS apps that serve as stand-alone git clients?
My experience with the git command line has not been great: I'm always getting into trouble where the repository gets messed up ("detached heads", for example) and it seems to take someone with a PhD in git to get me back to a functional, stable repository. Will GitHub help in those situations?
Xcode 10 integration with git is very intuitive and reliable. You can use Xcode for commit, push and see history of commits and so forth. Also Github macOS application works fine but I personally prefer Xcode to do so.
Using Xcode 10.2.1 with git and GitHub, brought me many troubles. I lost one day of development, because even though committing seemed fine inside Xcode, no commit was performed on the local .git repository nor on the remote Github repository.
The only way to recover a proper functionality was to checkout to the last committed version and loose all the job in between.
I have not been able to figure out the exact cause, but I noticed that opening several projects in Xcode and/or using playgrounds while developing on a project seems to corrupt Xcode git functionality. Quitting and relaunching Xcode corrects the trouble, most of the time ...
It's clear how to add an existing project to GitHub outside of Xcode, there are a number of tutorial: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
There are also a number of tutorial of how to create a new project in Xcode under version control.
However, there are no tutorial on how to do both: add an existing project with the controls within Xcode. Is this even possible? Or since I already started the project, I'll have to do it all via command line?
Since you didn't ask Xcode for a local git repository inside this project folder when you created the project, you will have to create one via the command line.
After that, you can use Xcode's internal GUI to give git commands in your project - if that's the kind of thing you really want to do (personally I abhor Xcode's git interface).
I'm currently starting to develop an ios app with some friends. We'd like to use a private github repository for version control so we can collaboratively work and push changes to the code. Xcode 5 creates a local git repository, but there seems to be some differences between using git for an iphone app versus the class projects (java projects like connect 4) that I've been used to.
I've created a repository on github, and pushed an initial commit from my local xcode project to the github repository. However, I'm not sure if others will be able to download the code and import it into an xcode project and have it work as intended.
For one, the files on github are organized differently than it displays from my workspace in xcode 5. From the project navigator, most of the yellow folders (folder references, which I don't fully understand) aren't actually folders, and don't appear on the github page. Also, many things (infoPlist.strings, frameworks) are represented in a humongous "project.pbxproj" file, along with confusing build information.
I know that this is a vague question, but I really had no idea what to look up or read. Let me know if there's any way I can improve asking questions on stack overflow. Also, if you know any guides that would help me out with this kind of stuff, I'm all ears.
Introduction
Git and Xcode work wonderfully together to create applications that foster teamwork and minimize versioning complications. However, it's important to understand the basics of Git before proceeding. This answer will walk you through the steps of integrating Git with Xcode, which really isn't too complicated once you understand what's going on.
The difference between Git and GitHub
(The OP might know this distinction, but this is really for anyone else who visits this page and is confused)
The first thing to understand is that Git and GitHub are two completely different things. Git is a version control system, like Subversion (SVN), or PerForce. It can be used independently of GitHub. GitHub is a cloud repository storage system that is integrated with Git. That's why it's called GitHUB; it's a HUB for your code and all it's versions/commits. Git can work with many repository storages, one of them being BitBucket. (This is unlike Subversion, which doesn't have a local repository and a remote repository; you have to push changes from your local repository to your remote repository in Git).
The question asked how to integrated GitHub with Xcode - the evil answer to that is you do not; you integrate Git with Xcode (which Apple has already pretty much done for you). When you commit something in Git locally, you push to GitHub, where your code is stored, and where others (e.g. team members or the public, depending on your privacy settings) can clone or fork your repository and build on it.
Create a remote repository
Let's assume you're starting from scratch. If you're not starting from scratch and already have code in a remote repository, skip this step.
In this step, you want to create your repository on GitHub or BitBucket. Follow the instructions that these sites give you to create the repository.
Getting the URL to Clone the repository
Whether you're using GitHub or BitBucket, you have to be able to tell Xcode where you are storing your code. Find the URI that allows you to clone the repository; GitHub and Bitbucket should have easy steps for finding these. Usually look for the word "clone" on the main screen of your repository, and you'll find it.
Clone locally
Fire up Xcode, with a new project. Hit the "Source Control" menu bar item, and select "Checkout". In the popup where it says "Or enter a repository or location", copy the clone URI that you acquired in your previous step. Then hit next. When asked to clone, Xcode will prompt for a branch; pick which one you want for now. If you have no idea what branching is, then choose "master".
Conclusion
Now you're all set. From now on, most things you need will be under the "Source Control" menu bar items as well; this includes committing, pushing and pulling. Enjoy, and good luck!
Setup the Xcode project as shown here.
Once, done you can see which file’s have been added,modified etc in project navigator.
https://www.dropbox.com/s/r5gsfh2raxwkam6/Screenshot%202014-07-30%2015.03.03.png
For commit,push, or to discard changes, use
Here’s detailed tutorial : http://www.raywenderlich.com/51351/how-to-use-git-source-control-with-xcode-in-ios-7
When using the xCode IDE when selecting file -> Source Control -> Pull or Push xCode crashes. The only workaround so far found for this is to load the organiser and select each repository and click pull then when then repository name displays cancel the dialog. After repeating this for each repository the normal push/pull options work fine until Xcode is restarted and then the process must be repeated.
This happens the same on all machines (4) at our office. The repositories are on github and there are multiple repositories being loaded in for each project.
We having been using the work around for some time but as we get more repositories this becomes more of an annoyance. Any suggestions welcomed.
I had the same issues with Xcode 4.3 so I have been using Xcode 4.4 and 4.5 for development (I'm not close the delivering yet, so it doesn't matter than I cannot submit my App using these versions yet).
An alternative would be to use an external source control tool; I would recommend SourceTree as it's free and works well. Other than that, there is always the command line.
I have a project on github that my developer and I used to collaborate on an iPhone app. That was my first exposure to version control and I used only a few tasks/commands: push, pull, stash on occasion.
We're now looking into making an OS X version and I'd like to use that previous project as the starting point for this new project.
It seems like this is FORKING the project. But I want to make sure that, once copied, the new (OS X) project has nothing to do with the previous (iOS) project. Is that what forking does? I've usually only heard it in regards to adding features. I've also heard the term cloning, but I believe that refers to making the local copy?
Try this:
Create a blank new project on GitHub
Do a git clone on the latest version of the iOS project to make a new copy of it.
Edit the information in the git config under .git in the copy folder to point to the new project on GitHub.
Forking is what you want. Creating a new project will lose the history from the original project, and will make it considerably more difficult to merge changes back and forth between the two. (Which you're likely to end up wanting to do if the projects are related at all.)