This article includes a step-by-step guide for making changes to someone else's repository. There is a model "Fork + Pull" for proposing changes on Github. It allows to connect to any Open Source project and propose changes to it.
The main idea of the model is cloning of a repository and making local changes. Then you can send a request with changes to owner of the repository. After that he accepts or rejects your changes.
We will show you how to use this model using a sample project. It’s called rgen. This program simplifies random data generation.
Preparing a Pull Request
For the beginning you need to clone the repository:open GitHub web page of the repository and click "Fork" button.
Pull the cloned repository to your computer with the following command:
git clone https://github.com/slaveeks/rgen
Local repository has one reference with a remote repository, which is called origin, it points to your GitHub copy, but not to the original.
A downstream (local cloned) repository commonly has to be kept in line with an upstream repository (original). This is helpful when development continues on the upstream repository while you work on your own origin. You have to fetch the upstream changes and apply them to your origin so you do not make conflicts.
That is why you should create a binding to the original repository in order to do what is said above. You can call it by any name. It is called upstream in this example, but this name is optional:
git remote add upstream git://github.com/nOstr/rgen.git git fetch upstream
After that you should create new branch and then make changes to it:
git checkout -b feature
Then you need to make commits:
git add . git commit -m "My commit"
After that you have to send changes to your copy of repository on GitHub:
git push origin feature
Now your changes are on the feature branch of your copy of the repository.
Pull Request Implementation
Now you need to open the web page of your repository on GitHub and tap "Compare & Pull Request".
Then preview page opens, which is used for the naming and description of changes.
Besides, on the top panel, you can choose which branch in the original repository will be merged into and which changes will be taken from the remote repository:
You can also see the list of your commits below:
And you can see changes of files:
After checking, you have to tap "Create pull request".
Then the web page with your Pull Request opens, where you can see it's status, changes. Moreover, you can comment and close your Pull Request.
You can also tap "Pull requests", where you can see the list of Pull Requests:
This article is about how to make changes to a third-party GitHub repository using Fork and Pull requests.
So you can work together with somebody on projects and supplement or correct the code of another person.