Welcome, friends, to your first lesson in version control. This article is entirely for non-expert-programmers. If you’re already an expert, this article isn’t for you. Shoo.
For those programmers who don’t already know it all, readable information can be hard to come by. Most of the things I’ve read about version control systems like Git and Subversion are written in harshly-accented programmerese. This is my attempt to simplify the concept in plain English for those of us who are just getting started…
So wait, what are we talking about?
Version control. Basically, people who work with plain text files a lot (front-end coders, developers, nerdy novel writers) find it useful to have a system in place that keeps track of every change they make to their files.
Don’t like what you just wrote? Did you accidentally destroy your whole program? Can’t hit “Ctrl-Z” enough to fix your mistakes? No problem! With a version control system in place, you can easily revert your entire project back to its last functional state.
Other benefits to version control systems include:
- Teamwork: they facilitate coding (or writing) projects as a team. More than one person can work on the code-base at a time, and the changes can be “merged” into the master copy of the project when they are done.
- Remote access: there are services like Github, Bitbucket, and Cloudforge that can host your projects on remote servers (with free and paid plans), allowing you to maintain a remote master copy of your work. These services are easily integrated with version control systems, keeping all of your work centralized. We won’t deal with remote repositories in this article, but it’s one of the huge benefits.
- Backup: if you and your team are using one of the above services to host your work, you always have a copy on hand if one of your team (or the entire team) manage to destroy their hardware. Conversely, if the server gets busted, everyone has a local copy.
- History: brought in a new coder and need to catch them up to speed? They can check out the project’s entire history. Wondering how you even got to where you are now? Go back and look at the code decisions you made. It’s a great tool for getting some perspective.
There are a few different version control systems out there, each with their own benefits and drawbacks. The two big ones, though, are Git and Subversion.
Git is the big one, and so far, it’s my favorite. Git is easy to install on Linux and Mac OS, and only slightly trickier on Windows. Some of the Windows trickiness comes from the fact that, while you can use Git with any number of graphical interfaces, it was originally designed to be controlled by the command line in Linux. (This also goes for SVN and every other version control system that I know of.)
It’s also faster and lighter than most of the alternatives, and it keeps project sizes down better than, say, Subversion.
It has a huge community with lots of resources behind it, and support is not hard to find. It’s got endorsements, too: renowned author, Cory Doctorow, uses git to manage to manage his drafts, his notes, his to-do lists, everything. I’m using it as well, for whatever that’s worth.
Want to install Git on your computer and try it out? This is not a difficult thing. Setting up the SSH keys and connecting to a repository on a remote server is tougher.
Don’t bother trying to pronounce it, just install it: msysgit is the project that brings git to Windows with a command line interface, a basic GUI, and right-click-menu integration or Windows Explorer.
For the Mac OS, just download the official client from Git’s website. Mac OSX is Unix-based, like Linux, and so the default installer should do you just fine. You’ll probably want to look at installing a GUI separately, though.
If you’re using Linux, chances are good you already know how to install Git. If you don’t, well, each different Linux distribution is a bit different. You’ll have to look up how to install it depending on which OS you’re running.
With all the great things I said about Git above, you might think you could just ignore Subversion. You’d be wrong. Subversion, brought to us by the guys at Apache, has a long history of use by large corporations and individual developers alike.
It might not have some of the performance advantages of Git, it’s been around for a very long time. Thus, it has a mature, knowledgable community to turn to for support, and a variety of fantastic GUIs available. Some people seem to believe that it’s also easier for beginners, but I suspect that depends more on the beginner in question.
Again, there are a variety of available clients, but my favorite is TortoiseSVN. It just seems to be the most user-friendly.
Subversion is shipped with OSX by default, which says a lot for the loyalty of some of its biggest users. There are other tools to check out of course. One of the most popular is Versions.
Whether you choose Git or SVN is largely a personal preference. Indeed, you may find yourself using both depending on the project in hand and the skills of your teammates.
What is certain, is that getting into the habit of version management is one of the most valuable skills you, as a developer, can acquire.
Take a serious look at version management, sooner or later it will save you some late nights rebuilding a lost project.