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.
# ? 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.