Pull requests (PRs)

Opening a pull request (PR)

Branches are a good way to test edits to your repository and see whether you like them. But they would be useless if they would be continuously developing independently of each other.

Luckily there is a way to fuse different branches!

It’s now time to merge and update your main branch with your edits. This can be achieved by creating a pull request.

Branches can be merged by a pull request.

Challenge: Create your first pull request.

1. Click on the create a pull request button:

  1. Open a pull request. Git will show you what branch will be merged into which when creating the pull requests. You can change this (hence you can decide what to merge into what) - but for now let’s keep the merge direction from Readme.edits -> main.

  2. Write a message for your pull request and click the create pull request button.

  3. Because you are the owner of this repository, you can also accept the pull request. Click the merge pull request button.

5. Congratulations! You have merged your first pull request!

About pull requests

You were able to merge this pull request right away because you are the owner of the repository - you made a PR to your own repository. This is not always the case - usually you want to add changes to a repository that you do not own (for example an open source project you want to contribute to). You won’t be able to merge the PR yourself then, but you will have to wait for the owner of your repository to accept your PR.

Why is it called pull request?

The pull request is a request to have your changes pulled into the target branch. The action while doing this is called pushing, so you push the changes to the target directory and request the owner of the target repository to pull them in.

The idea behind pull requests is that you usually make them to a repository you do not own - you need to wait for the owner to accept your changes and pull them in.