Create a pull request

When you use branches or forked repositories to work on a separate line of code from the codebase, you can use pull requests to get your code reviewed and merge your changes from Bitbucket Cloud. When you're ready to start a discussion about your code changes, it's time to create a pull request. Before creating a pull request, you might want to compare your code changes to the destination repository.

Some suggestions for making pull requests more effective

  • Try to make the pull request small enough to review but large enough to give you the context of the feature, bug fix, or update.

  • Use @mentions in your comments to guide reviewers or the pull request creator to specific items in the code.

  • Create Tasks for things that must be addressed for approval to help designate between suggestions and discussions and things that must be fixed.

  • Provide an accurate description and links to any issues to give reviewers more context and better access to what they need to understand the problem or feature you're addressing.

  • Use the special variable {{commit_messages}} in your description to create an unordered list of all commit messages when a pull request is created.

Compare code between the source and destination

When you compare branches or tags, you can select any two branches or tags to see a diff of the two. You might want to compare the updates you made with the destination branch to see all that you changed.

To compare your source code changes to another branch, do the following:

  1. From the repository with your changes, select Branches on the left sidebar.

  2. Select the a branch from the list of branches.

  3. In the Compare section of the branch’s page, select the dropdown to select a branch to compare to the current branch being displayed.

If there are changes, you'll see a Diff and a list of Commits. If the destination repository has new changes, you'll see (#) commits behind staging with a Sync now link if you want to update your branch with the new commits.

If there are no differences between the branches or tags, Bitbucket reports No commits to display.

Create a pull request

To create a pull request, you need to have made your code changes on a separate branch or forked repository.

  1. From the open repository, select the Create button and select Pull request in the This repository section of the dropdown menu.

  2. Fill out the rest of the pull request form.

  3. Click Create pull request.

Still need help?

The Atlassian Community is here for you.