Home » Software Development » Starting developing in Swift: Using GitLab with XCode

About Pascal Alma

Pascal Alma
Pascal is a senior JEE Developer and Architect at 4Synergy in The Netherlands. Pascal has been designing and building J2EE applications since 2001. He is particularly interested in Open Source toolstack (Mule, Spring Framework, JBoss) and technologies like Web Services, SOA and Cloud technologies. Specialties: JEE, SOA, Mule ESB, Maven, Cloud Technology, Amazon AWS.

Starting developing in Swift: Using GitLab with XCode

xcode_icon As showed in my previous post I have set up a GitLab account so I can host my Git repositories there. In this post I will show how you can combine XCode (v7.1) with GitFlow and GitLab. In fact I will end up to use both XCode (for programming) and the Terminal (for my GitFlow) but that is the same when I am developing Java. In that case I also prefer the prompt most of the time for my (basic) Git stuff.

It takes the following steps to setup your project:

  • Create the project in XCode
  • Create the project in GitLab
  • Link XCode project to GitLab project
  • Init Git Flow

Each step will be showed in more details next.

Create the project in XCode

This is the most easy part. Just create a new project in XCode and make sure that Git is enabled in the project:




Create the project in GitLab

Next step is to create a corresponding project in GitLab. This is also quite straightforward:


When the project is created copy the url to the repository:


Now we have two separated project so lets connect them in the next step.

Link XCode project to GitLab project

In this step we connect the two projects together by setting the remote URL for the local Git project. This means that by pushing the local repo to the remote one it ends up in our GitLab repository we just created. To ‘connect’ these two repositories open the ‘Source Control’ menu item in XCode for our new project and navigate to the settings:


Then select ‘Remotes’ and choose the option to add one:


In the popup fill in the name of the remote repo (default called ‘origin’) and the url you copied in GitLab for the new project:


Now you can commit and push your changes to the remote repository from XCode by selecting first ‘Commit’ and then ‘Push’ in the ‘Source Control’ menu:


So now we have XCode and GitLab connected. It’s time to put some Flow into it.

Init Git Flow

Open the Terminal in Mac and browse to the ‘MyGitProject’ directory. Execute the command:

git flow init

to initiate gitFlow for this project:


Now push the changes either in Terminal or XCode to the remote server. As you can see we are now working on our ‘Develop’ branch:




That’s it. If you look into GitLab again you will see our project has now two branches:


The way to go now is to create a feature branche in the Terminal with

git flow feature start SetupStoryBoard

like this


Now make your changes in XCode, commit them and when you are done finish the feature with

git flow feature finish SetupStoryBoard

and push the changes in the develop branch to the remote server.

  • Lots more of Git fun with XCode can be found here, here and here. More info why GitFlow with iOS here.
(0 rating, 0 votes)
You need to be a registered member to rate this.
Start the discussion Views Tweet it!
Do you want to know how to develop your skillset to become a Java Rockstar?
Subscribe to our newsletter to start Rocking right now!
To get you started we give you our best selling eBooks for FREE!
1. JPA Mini Book
2. JVM Troubleshooting Guide
3. JUnit Tutorial for Unit Testing
4. Java Annotations Tutorial
5. Java Interview Questions
6. Spring Interview Questions
7. Android UI Design
and many more ....
I agree to the Terms and Privacy Policy
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments