How To Submit A Pull Request On Github ?

Learn git.

Mon, 26 Nov 2018

In this post I will tell you about on how to submit a pull request to the organisation on which you are thinking to contribute. If you have not decided on which organisation to contribute to you can read my previous post -> Git Tutorial.

Now lets gets started with the steps…

  1. Step 1 :

Fork the repo.

  1. Step 2 :

Clone the repository.Open the terminal and write

git clone [URL]

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

  1. 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
  1. 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
  1. Step 5 :

You can now modify files.

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

  1. Step 6 :

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

git add .
git commit -m "Some Message"
  1. Step 7 :

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

git push orgin branch-name
  1. 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

  • Modify the file on your local computer.

  • git add .

  • git commit -a -m “Message”

  • git push origin branch-name

  • Now you see your pull request.You can goto 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:

  • git fetch upstream

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

  • now you can see that your branch is now upto date in accordance with the master of the upstream.

  • Add and commit your changes and push it to your github.


If you like such articles please show your support by following me on Github and on Twitter and also try to contribute by writing some post so that others can get some help from your knowledge.

Loading...
Amit Chambial

Amit Chambial I am a front-end web developer. I used to be a web designer also, but now I concentrate on the code.

  • All Contents subject to copyright
  • Amit Chambial