Should I select "Prefer to rebase when pulling" in Xcode Source Control - xcode

Should I check or un-check "Prefer to rebase when pulling" in Xcode Source Control if I want to have the option of choosing either to merge or rebase each time I pull? Should I always rebase or always merge in a single repository? I am the only person using the repository. There is little likelihood that any other programmers will work on this repository. Will Xcode allow me to change this setting later after I have started using the repository? One answer to this question says that it doesn't matter if I'm the only programmer. If my repository does start using additional programmers, would there be much problem?

Related

Managing branches and committs

I am not sure of the right place to ask this question as it is about procedure as opposed to programming. If it can be moved to the right location I would appreciate it.
I am continuing to learn the concepts of version control and TortoiseGit. But I am not sure on a concept ...
I have project A.
I am working on FEATURE BRANCH X.
I am not finished with FEATURE BRANCH X just yet.
But I would like to go back to project A and make some changes.
Then come back to FEATURE BRANCH A and continue with that branch and eventually merge it to project A.
I am concerned about losing commits and / or files. It has happened before to me.
I have only used basic Git, but I am pretty sure that such feature exists in TortoiseGit as well, it's called stash. It helps you to save your changes without committing them to the branch. After you stash changes, you can go to any other branch and work there. When you return to the branch with stashed changes, you pop stash and now these changes are available as unstaged.

Is it possible to replace the master branch in Xcode with my current "feature branch"

I have been developing a feature for my app in Xcode. I use the master-branch as my stable/production-ready branch. When i work on a feature i start a feature-branch. This particular feature branch I have been using has had a lot of significant commits (30+ commits) and now when i try to merge it into my master-branch Xcode tells me there has been a conflict with various files and the merge is unable to be performed. There is no option to resolve the conflicts.
I am using Xcode 8.0. At this point the feature-branch is far ahead of the master-branch and is production ready. I would like to begin working on new features but i don't want to make a mess by creating more branches off of the current feature branch. The only thing I can think of is to just completely replace the master-branch with my feature-branch but is this even possible? If so then how?
I have been unable to find anything in Xcode, Apple documentation or on stack. Thanks for any advice!
What you should do here is merge your master-branch into your feature-branch. Fix your conflicts. Test, make sure it works. When you're convinced all is good, merge feature-branch back into master-branch.
During this time, you can still work in master-branch as needed. But keep in mind more conflicts could arise. And in that case, I'd also just do master-branch -> feature-branch -> master-branch where the "->" represents doing a merge.
For conflicts, I actually don't use Xcode to resolve, but there are numerous resources out there to indicate how to do this.
I had a similar situation, but Source Control in Xcode wouldn't let me merge branches due to "tree conflicts". It just hung. Good thing I had a backup, cause I could no longer open the project.
After restoring the project from my backup, I did the following to replace the Master branch with my Development branch.
In Xcode I went to Source Control-> Working Copies and selected my Development branch as the working copy.
Under Source Control, I did a Commit for all my pending changes
In Source Control in the Working Copies section, I hovered over the the Development branch to expand the menu to the right and selected Configure project name
At the top of the Configure window, I selected Branches
I selected the Master branch and clicked on the - sign at the bottom and confirmed that I wanted to delete it.
Went back to Source Control, hovered over the Development branch in the Working Copies section and selected New Branch from the menu that expanded to the right.
Named the new branch "Master". This made Master the current branch.
When back to Source Control and changed the current branch back to my Development branch.

How to use private github repository for ios apps

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

Pulling All Remote Branches Xcode

I am writing a project in xcode with a team and we use git for version control. Xcode has a bunch of really nice built in features for git and one of the is the pull option. This is great but I would like to have xcode pull all the remote branches so that I do not have to pull them one by one. Is there an easy way to do this or will I be forced to the command line every time I wish to pull all branches.
Thanks.

git vs xcode snapshot

I am learning to program in iOS thru the itunesU videos and have been using xcode. I had found in xcode the feature to create snapshots which I have used to take snapshots of my project at each major milestone so far.
Then I come to the chapter on using git for version control and followed their instructions to the point of "git init", which gave this response "Reinitialized existing Git repository in /Users/username/Developer/Calculator/Calculator/.git/" instead of the "initialized empty git depository in /Users/...etc", which led me to think snapshot has already done it.
My question is: have I thus screwed up in any way the snapshots I had created in xcode before I ran "git init"? Thanks.
I think you just encountered an instance of the message not really meaning what it says.
Snapshots & git repositories are totally separate. Snapshots are stored in:
~/Library/Application Support/Developer/Shared/SnapshotRepository.sparseimage
By default, a project git repository is in:
$SRCROOT/.git
$SRCROOT is your project's "root" folder.
To me, it's not really a vs. or a "one or the other". I use both. I have XCode set-up to take snapshots after every build succeeds:
Xcode->Preferences...->Behaviors->Build->Succeeds->Create Snapshot
and commit to git:
Xcode->File-Source Control->Commit...
after every "big change" is complete.
This way, I can manage the "big stuff" (branches, merges, rollbacks) using git and investigate the small "what did I just break?" stuff with Snapshots. I rarely have to rollback a Snapshot. Off hand, the only times I can recall have been botched global Search & Replaces.
The only disadvantage is that Xcode won't let you compare the current code to the previous Snapshot using the difference editor. To compare the current code with a previous Snapshot, you have to:
Open the Organizer
Click on the Projects icon
Click on your project
Click on the Snapshot you want to compare
Click on the "Export Snapshot" icon at the bottom
Resize the drawer to a useful width and compare
Comparing Snapshots aren't as easy as comparing previous .git versions, but it has saved me a bunch of time when a small change has broken something in the current build.
Ray
There is no vs here. You can use GIT in xcode http://repeatgeek.com/tools/using-git-with-xcode-part-i/

Resources