Bitbucket and Xcode – Tutorial

Bitbucket and xcode tutorial

Git, Bitbucket are the tools that allow developers to store their code on the server as repositories and push/commit any changed made to the local machine code in to the repository code. The advantage of doing this is that if another developer is not working on the same machine then and is in a remote location, then he/she can carry on from where another guy left without even sharif multiple copies of code.

In this post, we will learn about Bitbucket and how we can use it with Xcode. The requirement for this is that you have an account on Bitbucket. If one did not have an account, then you can create it here

https://bitbucket.org

After creating your account, you have to create a team (optional) as shown below

Bitbucketandxcode-1

After creating a team, you have to create a repository, give a name for the repository, description and select language for it. After creating it, you will see a screen like shown below

Bitbucketandxcode-3

We are going to install git on our Mac machine using command line tool. Open Terminal and initiate commands as shown below

Bitbucketandxcode-4

This will install empty git repository on your machine. If you are getting error, then please install command line tool from Xcode preferences option.

Bitbucketandxcode-5

It’s time to get(install) our newly created repository(created on Bitbucket) to our local machine. Go to Bitbucket dashboard, Run these two commands shown inside rectangle

Bitbucketandxcode-6

Open Xcode and create a new project, we name it DemoProject. Save it inside your repository created earlier (in our case TestRepo).

Made some changes to your viewcontroller file and push it to the server repository.. Follow below steps

Commit Steps:

  1. Click on Source Control.
  2. Click commit. 
  3. Enter your comments.
  4. Click on Commit xx Files button.
Bitbucketandxcode-7

Push Steps:

  1. Click on Source Control.
  2. Click Push.
Bitbucketandxcode-8

Go to BitBucket dashboard and you will see your code there.

Bitbucketandxcode-9

Follow same steps, as listed above after making changes to files in order to push changes to server repository.

Commit Steps:

  1. Click on Source Control.
  2. Click commit. 
  3. Enter your comments.
  4. Click on Commit xx Files button.

Push Steps:

  1. Click on Source Control.
  2. Click Push.