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…
- Step 1 :
Fork the repo.
- Step 2 :
Clone the repository.Open the terminal and write
git clone [URL]
You can get this url from the Clone or download button.
- 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
- 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
- Step 5 :
You can now modify files.
Make sure you are on your feature branch.To check it simply run
- Step 6 :
After Modifying the file you have to add and commit it.
git add . git commit -m "Some Message"
- Step 7 :
After commiting now you can push the branch to your github.
git push orgin branch-name
- 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
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/masterwhile 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.