What is a pull request? How to open your first one

A pull request (PR) is a GitHub page that says "please review my branch and merge it into main". You push a branch with git push -u origin <branch>, open the PR on GitHub, and once it's merged you update your main with git pull.

Step by step

  1. Do your work on a branch:

    $ git switch -c croissant
  2. Commit, then push the branch:

    $ git push -u origin croissant
  3. On GitHub, click "Compare & pull request".

  4. After it's merged, update main and clean up:

    $ git switch main
    $ git pull
    $ git branch -d croissant

To review a teammate's pull request locally, run git fetch, then git switch <their-branch>.

Try it in the interactive sandbox →Practice “Open the pull request” with a real repository and teammates, right in your browser.

Related guides