Commenting on a pull request

The most important aspect of a pull request is the discussion it generates. You can comment on the entire pull request, a particular file, or on specific lines of code in a file to generate discussion relevant to your code review. You can also create a task or convert any comment to a task, so actions identified during the review can be easily tracked and resolved. Another efficient way to collaborate is to start a review, allowing you to leave multiple comments or tasks without sending them off to the author until you are ready to publish them. 

For more on what you can do in a pull request and an overview to the code review workflow itself, see Reviewing a pull request.

Comments

Places in Bitbucket Data Center where you can make comments:

  • Overview tab - you can add a comment on the Overview tab (just under 'Activity'), or reply to a previous comment. Use mentions to alert another Bitbucket user to your comment, and use Markdown to add formatting, for example, headings or lists. 
  • Diff view tab - display and create comments for a file directly on lines of code for commits and pull requests.


Draft multiple comments during a review process

When you are reviewing a pull request and you want to make multiple comments or tasks across various lines of code or files before the pull request is merged, you can manage your workflow more effectively by starting a review rather than adding your comments and submitting them one at a time.

To start a review:

  1. From the pull request you are reviewing, begin by selecting the Start review button in the top, right side of the page. You can also start a review from the comment form by selecting the Start review checkbox.

  2. Type your comment and then select Add comment.

  3. Add any other additional comments or tasks to your review.

While in a review:

  • comments are pending and only visible to you
  • all comments added will be part of the review
  • the author will be notified only when you publish the review

To publish a review:

  1. Select Finish review to open the Comments in review dialog.
  2. From here, you can review all of your feedback and add an overview comment.
  3. When you are ready, select Publish to send the review to the author.

If you want to delete all of the pending comments and tasks without publishing, use Discard review.


Tasks

You can create an ad-hoc task on the entire pull request, a particular file, or on specific lines of code in a file to track required work identified during a code review. Convert a task into a comment, or a comment into a task. Anyone with repository read permission can convert any other user's comments and tasks (and vice versa). A repository administrator can delete other user's comments or tasks and can also enable a merge check that requires all tasks to be resolved before the pull request can be merged. See Checks for merging pull requests.

For consistent tasks, admins can define default tasks at the project or repository level that are created when the pull request is opened. Learn more about default tasks

To create a pull request task:

  1. Select Add a comment  or the  icon on a line of code
  2. Add your text.
  3. Select Create task. 

When writing a task, you can use markdown to add formatting, images, and attachments to your tasks.

To see all the open and resolved tasks for a pull request:

  1. Use Shift+T on the pull request page, or click the Open tasks list button. 
  2. Select the 'View on' linked text in the Tasks window to see a task in the context of where it was created.

To resolve tasks for a pull request, select the checkbox next to the open task.


Suggestions

As a reviewer of a pull request in Bitbucket, you can suggest a small change to the code by leaving a suggestion right inside the comment or task itself. If you have write access to the source repository, you can commit the suggested change directly in the pull request without further action.

To create a pull request suggestion on a single line of code:

  1. In the comment dialog, click .

  2. Type your suggestion in the code block. You can also add any feedback outside of that code block. 

To apply a pull request suggestion:

  1. Select Apply suggestion.
  2. Edit the commit message if required and then select Commit changes to add a new commit to the pull request.

If a comment contains a code block that you'd like to copy, you can simply select the Copy button that appears every time you hover over this code block. The code will be copied and you can paste it wherever needed.

React to comments

Sometimes there's nothing more to say, and a 👀 or 👍 is all you need when replying to a comment.

To react to a comment with an emoji, select the Add reaction button, then select an emoji.

To remove an emoji from a comment, select it and it will disappear.

Resolve or collapse comments

After the author of a pull request has addressed or responded to comments, they can resolve comments by selecting Resolve. When a comment is resolved, it is marked as RESOLVED and collapsed by default. This helps both the reviewers and the author scroll past resolved comment threads and focus on the open comments.

Note that:

  • open tasks are not completed when you resolve a comment thread
  • you can only react to resolved comment threads but you can't edit or reply

You can always expand the resolved comments to view the entire discussion. If a comment or comment thread has been resolved accidentally or requires further changes or discussion, you can reopen it at any time.

If many comments on the pull request are still open and you want to focus on the code diff, you can quickly hide them to declutter your view.

Any user with Read acccess to the repository can resolve and reopen comments.


Viewing other comments in Bitbucket

When updating a pull request, comments that are in older diffs or that have become outdated due to a pull request update will become hidden. To view them, click the other comments counter button at the top of the page to open a dialog box with more context as to why code has changed throughout a pull request. You’ll be able to:

  • see a file's activity stream showing comments that are outdated or appear on another diff
  • distinguish which comments are actually outdated
  • reply to, like, delete, or react to outdated comments the same way you can from the overview tab
Last modified on Jan 2, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.