Fork and sync a project from Github
Forking a Github project is very easy as it is 1-click work, if that project is in public domain. Then cloning the forked project again is very easy with the git clone [$ git clone https://github.com/user/project.git] command. Even, the non git users of a large volume might have used the above command for various reasons.After a [few] commit[s], if we think that the cloned/forked copy of the main project is solving any issues or adding any new compelling feature [after running all the necessary tests] then making a pull request is also 1-click [followed by a few clicks] work.
In pull request, our modifications or code additions will be reviewed [best place to learn things] and any more modifications necessary will be pointed out to us. The chances are there even to get our pull request closed as someone else might have made a pull request that solved the issue in a better way than yours or due to million other reasons.
No matter what, I wanted to have my forked project in sync with the original [upstream] project and so does many developers. Here came the need for me to get to know about 'remote' [1]. So I did.
First checking remotes if any exists with the current repo.
$ git remote -v
If the upstream or the original repo from which the project have been clone wasn't present then add it [2],
$ git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
Method: 1
Then do fetch the latest changes from the upstream [3],
$ git fetch upstream
merge them with the local repo [it is advised to push/pull the local repo with your own remote repo and have them in sync before syncing with upstream] and resolve any conflicts if exists.
$ git checkout master
$ git merge upstream/master
Method: 2 [4]
$ git pull upstream master
pull does both the fetch and merge at a single step. Then do,
$ git push origin
to sync with your very own remote branch.
References:
[1] https://help.github.com/categories/managing-remotes/
[2] https://help.github.com/articles/configuring-a-remote-for-a-fork/
[3] https://help.github.com/articles/syncing-a-fork/
[4] http://stackoverflow.com/a/4936482