11 / 07 / 2012

The Importance of Version Control

Author

Simon Owen

Category

Blogs

Share

When building a website quite often there's more than one person working on the code at the same time. So what if someone is working on some code, then someone else comes along and updates the file? There's a chance that the initial code will be lost. What if your hard drive breaks and you've only got your code stored there?
Ooops… It's all gone.
You've finished building a site and uploaded it, then the server breaks. How will you get the site back up and running? The above issues unfortunately do happen, so in order to combat them and others some clever folks invented Version Control. Version Control allows you to work on code, then commit what you've done, often saving it in multiple places for added peace of mind along the way.
This means that if more than one person is working on the same bit of code and are both committing a handy notification will allow the users to asses the code that they are committing and what other users have committed.
Another benefit, is that if a piece of code is committed that breaks your project, it's possible to revert just that piece of code, so the rest of the code lies intact.
There's many different types of Version Control Software:
I first started using Subversion (SVN), but now use and particularly like Git teamed with GitHub.
http://git-scm.com/">Git is a popular form of Version Control, free, open source and used by the likes of Google, Facebook, Microsoft and Twitter.
Along with Git, GitHub allows you to manage all your Git repositories online. This is particularly useful as you can rest assured that if in the event your computer breaks or is stolen, you'll always have a back up of your code.
The GitHub User Interface has some extremely useful tools allowing developers to review each other's code, comment, 'fork' other people's code, amend it and request a pull to collaborate on various projects to name a few.
Gists allow snippets of code to be created and easily shared, useful for bits of code that are used on a regular basis.
By adding Version Control to your workflow you can rest assured that your code is safe, is easily maintainable and try out various new bits of code, knowing that at any time if it all goes pear shaped, you can simply revert the code to a previous state that was stable.
For further information here's a Tech Talk from Linus Torvalds who created Git:
The Git site also has some great videos and documentation to get you started:
As well as all the great stuff above GitHub has one of the best 404 pages on the internet:

version-control-type

When building a website quite often there's more than one web developer working on the code at the same time. So what if someone is working on some code, then someone else comes along and updates the file? There's a chance that the initial code will be lost. What if your hard drive breaks and you've only got your code stored there? 

Ooops… It's all gone.

You've finished building a site and uploaded it, then the server breaks. How will you get the site back up and running? The above issues unfortunately do happen, so in order to combat them and others some clever folks invented Version Control. Version Control allows you to work on code, then commit what you've done, often saving it in multiple places for added peace of mind along the way. This means that if more than one person is working on the same bit of code and are both committing a handy notification will allow the users to asses the code that they are committing and what other users have committed.

Another benefit, is that if a piece of code is committed that breaks your project, it's possible to revert just that piece of code, so the rest of the code lies intact. There are many different types of Version Control Software. I first started using Subversion (SVN), but now use and particularly like Git teamed with GitHub.

version-control-type

Git is a popular form of Version Control, free, open source and used by the likes of Google, Facebook, Microsoft and Twitter. Along with Git, GitHub allows you to manage all your Git repositories online. This is particularly useful as you can rest assured that if in the event your computer breaks or is stolen, you'll always have a back up of your code.

The GitHub User Interface has some extremely useful tools allowing developers to review each other's code, comment, 'fork' other people's code, amend it and request a pull to collaborate on various projects to name a few. Gists allow snippets of code to be created and easily shared, useful for bits of code that are used on a regular basis. 

By adding Version Control to your workflow you can rest assured that your code is safe, is easily maintainable and allow to try out various new bits of code, knowing that at any time if it all goes pear shaped, you can simply revert the code to a previous state that was stable.

For further information here's a Tech Talk from Linus Torvalds who created Git:

YouTube Video

The Git site also has some great videos and documentation to get you started: http://git-scm.com/doc

As well as all the great stuff above GitHub has one of the best 404 pages on the internet: https://github.com/404