1. Computing

Version Control

Working cooperatively on a coding project.

By

So, you have this project you're working on. You also happen to have other programmers helping. That's great! What isn't great, for beginning programmers, is figuring out how you can both effectively work on something at the same time. The concept can be a little overwhelming when you Google it, with command line interfaces and version controllers aplenty. Don't worry though, there are plenty of tools and websites out there to help with this specific problem.

First, let's talk about what a version controller is. There are lots of different strategies for tackling the problem of having multiple programmers on one project, but most use something called Version Control. There are even multiple solutions within this strategy, popular ones bing git, CVS, and Mercurial. These are basically a category of programs that manage changes made to your code. They have their own terminology and everything. Here are some basics to get you started:

Repository - This is the sum of your files and changes. You create a repository, and all the code and changes are stored in it. They can be hosted on a server, or even on websites like gitHub, which allow you to tackle source sharing as openly as you'd like.

Baseline or Trunk - Sounds just like it is, a baseline version of code that changes are, or can be made to.

Branch or Fork -  This one is somewhat obvious, but basically you create a second version of your program(s) that can be developed in parallel to each other. This can be useful if you have a stable version that you want to add a feature to, that might cause everything to be buggy, while still modifying that stable version. Or if you're actually just creating two different versions of some software.

Checkout - When you connect to a repository and download a copy of the source, that is called a checkout. Sometimes this is just a formality, but sometimes you're downloading a certain version or branch, and working on that specifically.

Working copy - This is the copy of the source code you have on your machine and are actively working on. If you have made or are making changes to code, they are only on your working copy and not on the repository's copy.

Commit or Checkin - This is when you save the progress you've made on your working copy back to the copy on the repository.

Merge - A merge can happen in multiple situations. You can probably imagine what they are. Common ones include if a branch is being merged back into the baseline, or if multiple changes are trying to be committed to the same file, the version controller puts those together in what is called a merge.

Now, all of this sounds a bit complicated. Especially when I tell you that a lot of these version controllers are built with command line interfaces. But don't worry. Especially if you use an IDE like NetBeans or Eclipse. These IDE's usually have plugins that make managing all of this a breeze. You can connect to or create and then connect to a repository, checkout a working copy, and start working with very little trouble.

I'd recommend just choosing git right now. It's open source, which means its free, and there is a lot of documentation, as well as tools and plugins galore. Obviously then, the first thing you need to do is install it. (Windows/Linux/Mac)

After that you'll want to see if there's a plugin for whatever IDE you use, if you do. Chances are there is, and you just have to Google for it. (git plugin for [insert your IDE])

There are also lots of tutorials and books on using git, even from git's official site, though if using a plugin, you'll probably want to refer to it's documentation.

  1. About.com
  2. Computing
  3. PHP / MySQL
  4. Advanced PHP
  5. Version Control

©2014 About.com. All rights reserved.