6

After following several tutorials I was finally able to take my existing, non-Git-Repository XCode Project and get it uploaded to a repository on BitBucket. I'm completely new to git but I'd like to start working with versioning. Since I'm a complete newb I'd rather not be working with the command line all day (which is what I had to do to get the project on BitBucket).

XCode's organizer now has access to the BitBucket repository. I successfully cloned the project back to my hard drive. My question is this: From now on, will the projects be in sync with each other? I'm not familiar with the lingo, and the difference between a branch and a fork. Essentially, I uploaded a 1.0 codebase and I want to start working on 1.1. I'd like to either fork the code or branch it so that the original project remains for reference. From what it appears, when I clone to my hard disk, XCode creates a new local repository instead of saving it on BitBucket.

I'm confused, please help!

Daddy
  • 9,045
  • 7
  • 69
  • 98

2 Answers2

3

Forking is a server-side operation where you clone the repo. For BitBucket, it is generally used with Mercurial (see "Forking a Bitbucket Repository").
This isn't what you have done.

You have simply cloned your BitBucket Git repo (now that BitBucket also support Git, and not just SVN and Mercurial) into a local repo and imported it in your XCode editor.
You can check it through command-line (git remote) or in XCode (See "Version Control System with XCode 4 and Git").

Note that you need to use an https address for your BitBucket clone address for being able to push back to the BitBucket repo from your XCode-managed local repo: see "Bitbucket + XCode 4.2 + Git".

For more on the basis of Git (especially branches), you can follow first the small labs from gitimmersion.com.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks, your Version Control System link explained that I needed to *push*. I need to get familiar with terminology, but I think you've put me on the right track. The gitimmersion link just gets too technical. information overload – Daddy Dec 10 '11 at 04:45
2

What you want to do is Branch your code from your 'master' i.e. your 1.0, to a 'develop' branch i.e. your 1.1 version. This is the simplest way for you to start getting used to version control. Once you create the branch using Xcode, the project in Xcode you are working on locally will be on that branch.

As you make changes to the code on that branch, 'commit' them from Xcode, and then 'Push' them up to Bitbucket (all done from the same menu in Xcode File>Source Control>...Xcode will ask during a push which branch to send changes to so make sure you select your Develop branch.

This will keep your local copy and your remote repo in sync as you develop your code.

This chapter in the Xcode user guide helped me immensely:

https://developer.apple.com/library/mac/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/SCM/SCM.html

How often you should do the commit and push dance will come from experience.

Good Luck.

mestevie
  • 41
  • 3
  • An important note for newbs (which includes me, as far as branching goes) is that uncommitted changes go to the new branch. When committing, be sure the check the box and confirm the newly created branch is listed. After pushing, the new branch is automatically created on bitbucket. You can confirm this by viewing on the bitbucket website. – Victor Engel Mar 22 '14 at 19:07