After you've added files and made updates to existing code, it's time to merge that code into your Bitbucket Cloud repository. Before you merge, you want to ensure that you maintain code quality and won't break already existing features. To get the feedback you need for code updates and improvements, you can create a pull request that includes all lines of code you've added. Pull requests provide you with a method for requesting code reviews from your colleagues and checking build status based on your most recent commit.
To use pull requests, you need a branch or a fork so that you can develop your code on a line separate from the main code base.
You can see how pull requests fits into a larger workflow example on the Workflow for Git Feature Branching page.
Pull request process
Code review and collaboration are at the core of pull requests. Here's how the end to end process works, follow by more details about different steps in the process:
After the author creates a pull request, a number of things can happen before a pull request is merged:
Reviewers look through the diff to compare the changes with existing source code. Learn more
Reviewers comment on changes and authors reply to comments, starting a discussion. Learn more
Anyone can create a task based on a comment and authors resolve tasks as they complete them. Learn more
Authors update code based on feedback and push new commits to the branch or fork, updating the pull request.
Authors check that all tests are passing on the most recent commit. Learn more
Reviewers approve the pull request when satisfied with changes.
Depending on your role, you may be an author, a reviewer, or both on two different pull requests.
Pull request authors
To find pull requests you've created, check the Your pull requests list on the Your work dashboard.
As a pull request author, the code review process officially begins after you create the pull request with reviewers. If you don't add reviewers during creation, you can always edit the pull request to add them afterwards.
After you've created a pull request and added reviewers, you might be inclined to take a break while you wait for approvals. However, as reviewers look at your code and make comments, you'll receive email notifications of the ongoing discussion in the pull request, giving you an opportunity to respond and making you become an active participant in the code review process.
Pull request reviewers
To find requests you've been asked to review, check the Pull requests to review list on the Your work dashboard. You can also go to the Pull requests page of your workspace's repositories to help your colleagues with other pull requests where you're not listed as a reviewer.
When a workspace member adds you as a reviewer, we'll notify you by email. After the initial notification about pull request creation, you'll continue to get email notifications for these occurrences:
- The author makes updates
- Another user makes a comment
- Another reviewer approves
- Another user merges the pull request
To disable notifications, you can unwatch the specific pull request.
During your code review, you'll comment with feedback, suggestions, and ideas. You may take time to consider if there are any obvious logic errors, all cases are fully implemented, existing automated tests need to be rewritten, and the code conforms to existing style guidelines.
After your review, if the pull request is ready to be merged (or if you trust the author to resolve your tasks before merging), click the Approve button in the top right. A green checkmark appears next to your name in the Reviewers field when you've approve the pull request.
If your workspace has a Premium plan, repository admins can prevent pull requests that don't have a certain number of approvals from merging.