The main purpose of this website is to support Android indie game developers with tutorials, reviews and promotion of their games. The main difficulty for the developers is not to make the game, but to get exposure. To get it out there. If you find anything useful here, please spread the word. Like my page on Facebook, follow me on Google+ or Twitter. Thank you!

Google+ Facebook Twitter

× close

Sunday 6 October 2013

AndEngine Tutorial - Using Git and GitHub

This tutorial is part of AndEngine basics.

<< List of all tutorials

Using GitHub is simple, but can be intimidating if you've never worked with version control before. If you did, you probably don't need this tutorial. I will cover the simplest case: Cloning the repositories from GitHub to your local machine. This replaces the steps in previous tutorials: Getting Started and Extensions and Examples.

What is Git anyway? 

It's a version control tool. Basically a storage for source codes (and other files) that saves the initial commit and then incremental changes.  Imagine you have a file that contains string: "Hello". You commit this file to Git and it will be saved as "Hello". When you make a change on your PC to "Hello World" and commit, the change will be saved as "Hello" > "Hello World" and the number of the line where this change occured. This way you can roll back to older version and track changes.

It also helps collaboration, creating forks of the projects etc, but again, if you need to do that, then you should not need this tutorial!

What is GitHub?

A free Git hosting for Open Source public repositories and paid service for private repositories.

So how do I use it?

First you need to install Git client. Because you are most likely using Eclipse IDE (or Google's ADT which is Eclipse), the easiest way is to grab the Eclipse Git plugin.

Go to Help -> Install new software.

Click Add to add a new plugin repository and use this URL as location:

Click OK and Select All.

Then simply click Next and accept all licenses until you can press Finish. If you are asked to restart ADT (Eclipse), do it.

Clone the repository from GitHub to Desktop

Cloning in Git means making a copy from the repository into local machine. That is an exact copy that can be synchronized with the repository. As opposed to fork, which is a new copy... But don't worry about forks now.

In Eclipse, go to File -> Import and select Git -> Projects from Git

And then from the options select "Clone URI". Enter the repository of your choice as URI and the rest will be filled in by Eclipse:

To get the Git repository URI  e.g. and copy the URL of the Git repository from this box:

On the next screen select only the branch that you are going to use. Branch is a separate version of the project - using the GLES2-AnchorCenter is recommended.

Then select local directory, I highly recommend using the workspace folder.

Wait for Eclipse to download the project and last step, select "Import Existing Projects"

Click Next, and then Finish and you have successfuly cloned Git repository to your desktop. Do this with any repository you need.


Having the cloned repository is useful, because you can then easily get latest changes without downloading everything again. But if this is easier than the download-zip method, I leave up to you!
Martin Varga is a Czech software developer who likes pygmy owls (hence Kulíš), running, ramen, travelling and living in foreign countries. He is also known as smartus or sm4 on the internet (read as smartass, but there are too many of them). He currently tries to make games in AndEngine like Mr. Dandelion's Adventures and hangs around a lot at the AndEngine forums.