How to use Git to contribute Open-Source code

Hello! This is my first blog here in WordPress. I’m going to tell you how to use GIT to upload and contribute your code to the open source community.

WHAT IS GIT?

Well it is actually a Version Control System that works in a distributed fashion. Organizations and individuals who start an open source project hosts a GIT server. To add code to the project, we need to seek permission from the project administrator and then push the code to the server to make it available to the community. The mechanism is complex although as an user the task is pretty simple.

Here’s how to do it:

Obtain Git: It comes pre-installed on virtually every Linux distro. If you are using Windows you may consider using msis Git, which runs on top of Cygwin as a port of GIT on Windows. Visit http://git-scm.com/download for more download options.

Step 1. We need to clone the Git Repository hosted out there on the internet onto our own computer.

git clone git://git.kernel.org/pub/scm/.../linux-2.6 MyFolder

Step2. Go to MyFolder. You will find the entire directory structure cloned into this folder from the Git upstream.

Step3. Work and change the codes or anything you might want.

Step4. Use the command

'git add foo.c foo2.c otherfile.x'

Step5. Use the command

'git commit'

This command will open a window for you to add comments on what you changed to the code just now. This is essential to coordinate with the other programmers so that they can easily understand what you just did. Check out this link for a guide to writing proper Commit messages:

http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html

Step6. Use

'git push git://yourgitserver/ master'

Here is where the magic happens. Your code gets uploaded onto the Git Server as a master. Now everyone would be able to see and download your code and view your commit message as a Git log!!

Note: Your firewall/proxy should be configured so that you can access git,ssh,http,https protocols. If not you will get an error.
You will get an error code 22 if your login credentials are improper. Sometimes you need to provide it in a ~/.netrc file.

For additional resources see:

https://git.wiki.kernel.org/index.php/Main_Page

http://www.kernel.org/pub/software/scm/git/docs/

http://en.wikipedia.org/wiki/Git_%28software%29
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s