New to Bitbucket Cloud? Check out our get started guides for new users.
To add reviewers to check and approve your code prior to merging, your next step is to create a pull request. In addition to a place for code review, a pull request shows a comparison of your changes against the original repository (also known as a diff) and provides an easy way to merge code when ready.
Step 1. Create the pull request
You need a branch to create a pull request. Good thing you created a branch in the previous section of this tutorial.
From the open repository, select the Create button and select Pull request in the This repository section of the dropdown menu.
Fill out the rest of the pull request form. See the screenshot below for a description of each field.
You've already got an automatic Title, your last commit message.
Add a Description if you'd like.
(Optional - adding a reviewer) If you need someone to review or approve your code prior to merging, add them via the Details tab on the right sidebar - select Add reviewer to start adding reviewers to your new pull request. You can see that we have added a reviewer named Breezy Cloud to the example pull request below.
In order to add a reviewer to a pull request, you must first grant the user access to your repository by adding them to a group. For more information and detailed steps, refer to the following: Grant repository access to users and groups. Note: You can always create the pull request and then add reviewers later.
3. Click Create pull request. Make sure you are in the repository where you want to create the pull request.
Bitbucket opens the pull request, and if you added a reviewer, they will receive an email notification with details about the pull request for them to review.
Step 2. Merge your pull request
Not so fast! You may have noticed the Merge button at the top. Before you click it, you need to wait for an approval of your changes. In addition to the email notification your teammates receive, they'll also see the pull request appear under Pull requests to review on the Your work dashboard.
From the pull request, the reviewer can view the diff and add comments to start a discussion before clicking the Approve button.
When someone approves your pull request, you'll get an email notification. Once you've got the approvals you need (in this case just one!), you can merge. From the pull request, click Merge. And that's it! If you want to see what it looks like when your branch merges with the main branch, click Commits to see the commit tree.