how to create rss in php
 


 

How to Collaborate on Github Open Source Projects



Git is an open source distributed version control system, initially designed and developed by Linus Torvalds for Linux kernel development in 2005. For may years, centralized version control system (like CVS and Subversion) were very popular to Open Source developers community. At the same time, distributed version control systems become more and more popular. Github founded in February 2008, was one more reason why Git really took off. GitHub provides free hosting for Open Source projects with unlimited collaborators (as well as commercial plans for private repositories).

There are mainly two ways to collaborate using Github.

  • the shared repository model
  • the fork and pull model

When you create a repository in Github, even a public repository, only you have "push" access to it. To allow other people to "push" to this repository you need to add them as Collaborators (they need to have a Github account, even free). This is basically the "shared repository model", which is a good solution for small teams, where members know and trust each other.

However, this solution cannot be applied to large teams, where everybody has the right to contribute (the so-called "social coding"). In this case, the "fork and pull model" is the suitable solution. Any Github member can "fork" a public repository. Forking the original repository, another repository is created (the forked repository). You can apply any modification to this one. Changes will not affect the original repository, until you submit a Pull request. In case your pull request will be accepted by original repository owner, your changes will be merged to original repository.

Since two years, BitBucket offers a similar service with Github. The difference is that BitBucket allows unlimited repositories for free (even private), but only for five collaborators. For more than five users, there are paid plans.

Here is a real example of "fork and pull model". Even I have an active Github account, I will describe all the steps for someone who just starts with Git and Github. I will fork a public repository. Changes made to forked repository will be merged to original one after a pull request. Here is how.

Setup git

You can easily setup Git in any operating system. Detailed instructions are available at http://git-scm.com/downloads

Getting started instructions: http://git-scm.com/book/en/Getting-Started-Git-Basics

An excellent interactive tutorial is available here: Try Git

Create a Github account

If you do not already have a Github account, create one for free. Just go to: https://github.com

Fork repository

In this step I will fork the public repository named "CodeHouse" at https://github.com/phpdevelopersindia/CodeHouse, just pressing the fork button:

(click the thumb for full image)

After I forked this repo, this will appear to my Github profile as a forked repo: https://github.com/pontikis/CodeHouse

(click the thumb for full image)

Watch repository

As I want to receive email notifications for changes in CodeHouse repository https://github.com/phpdevelopersindia/CodeHouse, I press the watch button to Watch the original repo:

(click the thumb for full image)

Clone forked repository

In order to get forked repository contents to my hard disk, I have to clone the forked repo (this process will be performed once):

cd /srv/http/dev
git clone git@github.com:pontikis/CodeHouse.git

This will create a directory CodeHouse.

cd /srv/http/dev/CodeHouse

With the following command:

git remote -v

I get the remote repositories of local repo:

origin    git@github.com:pontikis/CodeHouse.git (fetch)
origin    git@github.com:pontikis/CodeHouse.git (push)

In order to be able to get original repository contents (not only the forked one), I add it as a remote repository, as follows:

git remote add upstream git@github.com:phpdevelopersindia/CodeHouse.git

(where upstream points to original repo)

Now, giving the command:

git remote -v

I get the following results:

origin    git@github.com:pontikis/CodeHouse.git (fetch)
origin    git@github.com:pontikis/CodeHouse.git (push)
upstream    git@github.com:phpdevelopersindia/CodeHouse.git (fetch)
upstream    git@github.com:phpdevelopersindia/CodeHouse.git (push)

Please, note that "origin" is the forked repository and "upstream" is the original repo

Update original repository

In order to update the contents of the original repository to my hard disk:

cd /srv/http/dev/CodeHouse
git fetch upstream
git merge upstream/master

Share your code

After creating changes to local repo, I add and commit them to local repo. Afterwards I push them to forked repository.

cd /srv/http/dev/CodeHouse
git push origin master

These changes will not affect the original repository, until I submit a Pull request:

Pull request

From the forked repository https://github.com/pontikis/CodeHouse and using Github web interface, I select the "branch" contains my changes (in this example only a master branch exists) and I press the "Pull request" button:

(click the thumb for full image)

Then I submit my request. I write a subject and a short description and press "Send" button.

(click the thumb for full image)

Now, I am just waiting for acceptance of my request from CodeHouse repository owner.

Merge Pull requests

Original Repository https://github.com/phpdevelopersindia/CodeHouse owner can see pull requests as follows:

(click the thumb for full image)

and can accept a request, as follows:

(click the thumb for full image)

Finally, after pressing the "Merge" button, my changes are available to original repository.

Enjoy social coding!

We welcome your feedback. Leave us a comment.

Εγγραφή!
Sign-up for our free email newsletter. Get updates when new tutorials and tips are published. You can unsubscribe anytime with a click.

Your comments are welcomed!

This site actively encourages commenting on any post. Comments are not pre-moderated, but this community does not tolerate direct or indirect attacks, name-calling or insults. Please, read terms of use and Comment Policy at privacy policy.

Cheap Quality Images for your Blog How to Use PHP Improved MySQLi extension (and Why You Should)