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 the destination, do the following:

  1. From the repository with your changes, select the More options () button and select Compare branches or tags in the dropdown menu.
    Bitbucket displays the Compare page.

  2. Adjust the source (top) and destination (bottom) fields so they match the pull request you anticipate making.

  3. Press Compare.

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 under the Commits tab 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 There are no changes.

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.

After creating a pull request, you can modify its description or anything else on the form by selecting Edit on the pull request's page.

Still need help?

The Atlassian Community is here for you.