Git source control for single web developers

Do you like to put code together on your own? Are you a single developer? If so, you may wonder why you need version control (and all the headaches associated with it).

I used to be in the same boat as you. Now that I work on websites at Advanced Venture Solutions on a team with others, I find version control indispensable.  However, I also realize just how useful and simple Git would have been all those times I pieced together projects by myself.

Git keeps a copy of the changes to your code, so you can see your code at any point in time. Git is designed to be as useful for an individual as it is for a team. In fact, Git is even easier to use as an individual.  So don’t delay, start your version control today and reap the benefits of Git version control for web developers.

For space considerations, I will assume you use Windows (I use both depending on needs in real life).

Step 1: Install a LAMP stack

Go to Apache Friends and install XAMPP for Windows. Make a note of your web directory (usually an htdocs folder).

Step 2: Create a website locally

Create a folder in the htdocs directory and place some html, php, or whatever else in it.

Step 3: Install Git

Download and install the latest version of Git for Windows. This is by far, your easiest option. Follow the installer options. Make sure to have it add Git to your system path variable so you can access Git from the command line.

Step 4: Open Git Console

This is self explanatory. The Git Console was just installed in the previous step.

Step 5: Navigate to web folder and create repository

Once you are in the folder where you want to create a Git repository, type:

git init
git add .
git commit -m 'Initial commit'

You now have a source code repository!

Step 6: Make additional changes to your files and commit

From now on, you can save a version any time. Just type:

git add *
git commit -m 'Whatever your message is about these changes'

This is a brief overview and will certainly get you started. After you’ve done this for a while, you’ll find you wish to browse old code, revert, see changes, etc. All these are very possible through very easy commands. Just check out the git cheat sheet for more information.

AVSHost – Android and Web Development