Learn Tech Skills

Version Control

Version control keeps track of the changes you make to a file.

Version control keeps track of the changes you make to a file.

Have you ever accidentally deleted something in a Word document, saved and closed it, only to discover your error hours later when it’s too late to fix? Version control solves this problem!

Version control keeps track of your files and remembers all of the changes you’ve made and when you make them. If you screw something up, no problem, you just roll back to an earlier, less-screwy version and work from there. Problem solved!
Instead of tracking each and every time you hit a key like Word does, though, you bundle up all of your changes into something called a commit. This set of changes could be anything from changing a typo or fixing a bug to adding a whole new page to a web site.

Developers use version control to keep track of changes in their code, but you can use it for anything. Poets use it to track their poems, businesspeople use it to track their reports – you name it, you can use version control on it! Each commit could be a new stanza, a change to a header, or a whole new feature.

While version control is definitely useful for keeping track of your own files, it becomes more and more important when you are working on the same files with collaborators. Instead of sending a file back and forth to work on it, we can all work on the same files at the same time thanks to something called merging.

Merging takes commits by two or more people and combines them into a new, complete document. You can fix the first paragraph while I work on the last paragraph and we won’t overwrite one another because we use version control!

Imagine this: you are working on a web app, made up of hundreds of files of code that all work together in a very specific way. Now imagine that there are ten members of your team and each one of them is fixing an issue in a different file. Without version control, team members could overwrite one another’s changes or otherwise accidentally delete all of another team member’s hard work. Version control helps manage that workflow so no one steps on anyone else’s toes, and if something does go wrong you can always just go back to an earlier version.

While there are many different version control systems out there, two popular ones for developers are Subversion (a.k.a. SVN) and Git. They each have their own strengths and weaknesses, but both work great at keeping your changes in line.

Cocktail Party Fact

There are web apps built in Ruby, PHP, Python, ASP, and all manner of other computer languages (even one called Groovy!), but all of those web apps use version control to keep track of their work.

If you’re planning to work professionally as a web developer, you’d better learn version control!

Now try this!

Github is a social coding website that allows developer to share their code and keep track of their changes using Git.

  1. Take a look at this link, which links to a specific change made by one developer on the Timeline Project.
  2. Notice that github tells you when the change was made (2 days ago), who made it (jfkeefe), what he called the change (‘fixed tweet button info’) and then shows you what file he changed (index.html), what he deleted (in red) and what he added (in green) to the code.
  3. That’s version control!