How To Submit A Pull Request On Github ?

Subscribe to my newsletter and never miss my upcoming articles

In this post I will tell you about on how to submit a pull request to the organization on which you are thinking to contribute.

Now lets gets started with the steps...

1) Step 1 :

Fork the repo.

2) Step 2 :

Clone the repository.Open the terminal and write

git clone [URL]

You can get this url from the Clone or download button.

3) Step 3 :

Create your own feature branch.

git checkout -b branch-name

To switch branches you can use

git checkout master \\switch to master
git checkout branch-name \\ switch to branch-name

4) Step 4:

Add upstream or you can say a remote. A remote is the url on which the actual repository exist [From where you have forked the repo].

git remote add upstream URL

5) Step 5 :

You can now modify files.

Make sure you are on your feature branch.To check it simply run git branch.

6) Step 6 :

After Modifying the file you have to add and commit it.

git add .
git commit -m "Some Message"

7) Step 7 :

After commiting now you can push the branch to your github.

 git push orgin branch-name

8) Step 8 :

Now go to your github.You can see an option of create a pull request there.CLick on it and write some message there. In the message you must relate to some issue like #1992 etc #1992 is issue number .You can go to issues and see that every issue has an issue number.

Now submit it

Important Notes:

  • After submiting the pull request if the a member of that repo tells you to make some changes then follow below mentioned steps

1) Modify the file on your local computer.

2) git add .

3) git commit -a -m "Message"

4) git push origin branch-name

5) Now you see your pull request.You can go to file changed and see that all your changes have been effected there also.

  • If there is some problem related to that your branch is n commits behind and therefore not able to merge, then you can go to local computer and follow below mentioned steps:

1) git fetch upstream

2) git merge upstream/master while being in your feature branch.

3) now you can see that your branch is now up to date in accordance with the master of the upstream.

4) Add and commit your changes and push it to your github.

No Comments Yet