Mobile Development

Version Control

Version control provides a number of benefits to the developer. Here are some of those benefits:

  1. History
  2. Version Control
  3. Branching
  4. A Distributed System

Benefit 1: History

Imagine working on a piece of code. Let's call this version 1:

var eureka = "The meaning of life is the following number"
var meaning_of_life = 42
print("Guys, I've figured it out.  \(eureka) is \(meaning_of_life)!")

Then after a few days, you change your mind and update the code. Let's call this version 2:

var eureka = "The meaning of life is the following number"
var meaning_of_life = 99999
print("Guys, I've figured it out.  \(eureka) is \(meaning_of_life)!")

Some time passes, you close Xcode, shut down your computer and then you realize:

The first version was right! What did I have?

With Git, you can have a historical record of all changes made in your code. You can then reference those changes at a later time.

var meaning_of_life = 42

Benefit 2: Working with a team

Now imagine you are working with a team of three programmers on an awesome new app. There is one Xcode project, three programmers and one manager.

The benefits you get with a version control system, such as Git, in this scenario:

  1. Historical record of what each programmer was working on and when
  2. The ability to go back in time and view changes from a different day for any of the programmers on the team
  3. Automatic merging of changes from each developer into one central project
  4. One central project that a manager can download and send off to the client.

Benefit 3: Branching

Branches are commonly used to segregate new code from the existing project. Let's say your manager decides she wants to incorporate a new feature into your awesome app and only wants that feature to be available to the rest of the developers when it's complete and ready.

With Git you can work on your own branch and incorporate your changes at a later time, while retaining the other benefits of version control, as previously described.

Benefit 4: Local versus Remote - A Distributed System

When you're working with Git, you are working with your own copy. This is what we refer to as your local copy. With your local copy, you can do whatever you want. Add some new buttons to your app, change todo en espaƱol, get dangerous and experiment and tinker throughout the app.

This is a great way to learn and experiment

This is your local copy and you're not affecting others. You can commit changes to your local copy (even without Internet access) and decide to abandon it all and get a fresh copy from the remote.

When you're ready, you can publish your changes from your local copy into the remote repository.

References

Why Git? - http://www.markus-gattol.name/ws/scm.html