Monday, April 5, 2010

Git For Newbies

Note: This is not a complete guide for git. It will just help you getting started and using smoothly.


Git is a versioning system. It is an ideal tool for managing projects, revisions and stuff like that. Anyone who wants to contribute can clone the code repository, make the changes or add some code and request for merge. This way bug fixes can be done and new features can be added. Gitorious provides open source infrastructure for hosting open source projects that use Git. The central entity in Gitorious is the project, which contains one or more top-level repositories and any repositories managed by the project's contributors.

Cloning A Repository on

We will use's hosted git for example. First of all you need to register yourself with which is a straight forward step. We are going to use ownCloud, a KDE project, for illustration. Next, go to and click on "Clone this repository on Gitorious" from the right sidebar. Congrats! you have created a clone for yourself.

Cloning A Repository On Your Local Machine

We have to do this the hard way. I am considering the Ubuntu Linux in my mind. First of all we need to install git. For that fire the following command
sudo apt-get install git-core

Once you get the git on your system, let us now create the clone. For that fire:
git clone git://

Now that you have the code, you can start with the bug-fixes and contribute code.

Commit To Local Git

After you make the changes to the code or add some file, you'll need to commit that to your local git repo. If you have added some files then you have to tell git to track the new files by using the following command:
git add file-name.

Once the files are added then you can commit to the git repo by firing the following command:
git commit -a

You'll be presented with a file where you have to describe the changes you made. Keep it short and to the point.

Pushing To Gitorious

Now you can push the changed repository to the repo by:
git push master

This will push the repo from your system to Now request a merge from the right sidebar. Someone will look at your request and your work will be added to the main repo if found fit.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.