Tuesday 10 November 2015

Version control ethics with GitHub

The following post is going to cover the standard procedure of contributing to a project hosted by an individual or an organization on GitHub.


  1. Search for the project or open the project you are invited to & fork the repository to your account.
  2. A fork is a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project.
  3. To fork a repo, you will see a "Fork" button on the righter side. Click that. 
  4. Clone the repo to your local machine using GitShell or any git client.
  5. Contribute to the project the way you want. Keep in mind the standards of coding while contributing to a collaborated project.
    A code must not only be smart but also beautiful. A beautiful code is a readable code. This is a must when working in a team so that your fellow mates can understand what you want to do and what they have to do further. Google about coding standards to know more.
  6. Once your module is ready, do not push it directly to master branch. Generally, as a contributor you don't have the permission to commit changes in the master branch of the repository. When you fork a repository, there ought to be a maintainer and/or an owner who takes care of what goes in the master branch of the original repository. Whatever changes you make in the forked repository does not affect the original repository until and unless it is permitted by the owner/maintainer.
  7. So you create your own version of the module and push the code there. This version is called a branch.
  8. Create a branch of any name you want by,
    git branch <branchname>
  9. To change the current branch type,
    git checkout <branchname>
    Refer to the tutorials posted in the earlier post for a clearer idea of this.
  10. Once you have added all your untracked files to your own branch, git push it all.
  11. Now your copy of the module is updated to the forked repository, to merge your branch with the master branch, you need to generate a pull request to the owner.
  12. To generate a pull request, open up your forked repository and click "Pull request" on the righter side, click on "New pull request" and select your branch in one drop down while the master in the other. It will show all the changes you made with respect to the other branch.
  13. Type in the essential commits and comments and generate the request to merge your branch with the master branch.
  14. If the owner/maintainer finds the pull request sufficing then he might merge your branch with master. Else they will comment the problems. Once merged with the master branch, they might open Issues with your request which you will have to solve.
GitHub has bridged the gap between coders overseas. If all is followed correctly, a greatly collaborated teamwork can be exercised online using version control software like GitHub.
Hit the +1 if you like my post, comment your views and confusions.

Start forking, start contributing!

No comments:

Post a Comment