Location independent Web designer & developer

Backup and share your code with GitHub

Anyone who is taking web design/development work seriously needs to think about managing of code. OK so what do I mean with “managing” the code? Basically there are two things you need to keep in mind. Backup of your code in case of hardware failure and keeping the history of your code in case you made a mistake and you need to roll back. For both of these cases and couple of others you should have online repository. The repository is place where you keep copy of your code with all its changes. So far I have been using Google Code as my repository. It has only been recently when I switched to GitHub.
As I have said before there are other advantages of repositories. One of the main one is cooperation while working on projects in the team. There is just simply no other solution. If there are two or more people working on the same project they need repository. It is just impossible to manage the code without it.

GitHub is a free service and you can store as many repositories as you wish unless you want your code to be private, not visible to others. You can find there repositories from huge companies to single “hobby” coders. You can see the source of many popular applications and learn from it, what more, you can fork it (take the code and start creating your own version of it).

Setting up the repository is pretty simple and takes only couple of minutes. The communication is done through tools like terminal (command line). There are only about four commands you need to learn to be able to start using it. You would need to install Git first though.

The biggest advantage of Online Repositories

This time I am just presenting my personal opinion. The feature which is most valuable is creating branches. Let me explain it to you on a real example. Let’s say you have project – web site which has been launched into production server and you keep on working on it. That means there a working version on a public domain and there is your version which includes all the latest changes which has not been published yet. Here it comes. The customer asks you to fix some stuff on the current site. Fixing the issue and uploading the code would mean that you upload all your new code with all the new stuff but you can’t do that because that is not finished yet or there is set time/date when all these new features could be published. Yeah that would just simply be pain so let’s look at how you could do it properly. After you finish your version of code and upload it to public domain you create a branch. In reality it creates exact copy of your code so from now on you have two copies of your code. You can now develop new features on a new branch and when customer calls you to fix something on current production version you can just made those changes on the original branch and upload it (push it) straight away. Your new branch with all the new features will stay untouched. When the times come that you need to upload the new features which you have been building in the second branch you can just simple merge those two branches and upload it to production. The you would normally create third branch. I think you get the idea. I have to say that it would not be really fair to call this Gits solution because you can do the same with SVN subversion for example.

It does not really matter what do you chose. Git or SVN or something else but make sure you have your online repository. It makes your life lot easier, better and organized.

join discussion

Published in 2009

9 08

Images and video for this Article