Pull request are based on branches not on individual commits. To create a pull request we need to first create a branch then commit changes and then we are ready to create a pull request.

Commit without Pull Request:

What if you would like to expose your code for a teammate review? Would you risk pushing changes to master branch? Using pull request you can get a change feedback before deciding on pushing changes to a repository.

When working on a open source repository, where you have no access to change this repository you might want to fork this repository, make changes and then pull changes to a source repository for the authors to review your code or marge this changes back to the original repository.
https://youtu.be/Uszj_k0DGsg?t=1175
# ? Fork some public repository
# clone repository
git clone someforkedrepourlhere
# create a branch for pull request
git checkout -b change
# make some changes to a file and add this file to staging area
git add filename
# commit change to a branch
git commit -m "Some change"
# push changes to you fork repository
git push --set-upstream origin change

Now you can navigate to your github account and see the pushed changes. Github will automatically prompt you with a pull request button:

When pressing pull request button you will be redirected to pull request form, where you can add some additional information for the original repository maintainer.

0
Would love your thoughts, please comment.x
()
x