Can I somehow enable auto-update of BitBucket pull-request description for post pull-request commits like on Github?
Asked Answered
F

2

11

Can I somehow enable auto-update of the pull-request description on BitBucket Cloud for commits pushed after pull-request creation, like on Github?

Scenario:

  1. I finish some work and make my last commit.

  2. I create a pull request using BitBucket Cloud (bitbucket.org). The default auto-generated PR description includes the git commit messages that comprise the pull request.

  3. After PR creation, I later realize I need to push another commit.

  4. The code for this commit gets added to the pull-request as expected.

  5. The commit messages don't get added to the pull-request description so the reviewer has no context or visibility of the added code. They may have even already partially reviewed and may miss these new changes.

Is there a way to auto-add commit messages to the pull-request description like it does with GitHub?

Faria answered 31/5, 2018 at 11:50 Comment(1)
I'd suggest to remove the git tag, as this feels like a purely bitbucket related questionGlassy
G
1

Apparently, as of 2014 bitbucket should be auto-updating as described in your scenario. Some debate was going on for quite some time, but recently Atlassian stated that

Given the relative lack of discussion on this issue in recent years, and since the team is currently focused on higher priority items, I am closing this issue to indicate that we don't plan to address this in the near future.

The update is not immediate, but should happen after another Pull Request is merged (strange as it is).

In conclusion, it appears that Bitbucket is not going to prioritize the feature or improve its current behavior soon.

Glassy answered 1/5, 2020 at 10:14 Comment(0)
A
1

Unfortunately Atlassian does not seem likely to ever provide a fully automated solution to the functionality requested by this question.

In lieu of full automation, I wrote the following Linux/macOS/WSL script that uses the git command-line interface to generate a list of commits for a given branch, formatted in a way suitable for pasting directly into the BitBucket PR description field:

#!/bin/sh
DISPLAY=
exec git log -n40 --pretty=format:'#### %C(yellow)%h %ad%C(reset) ####%n%B' "$@" 

This script makes it easier to manually update the PR description when you push some new commits to a PR branch. Assuming you've named the script gitlog-md, you invoke it with an optional branch name argument naming your PR branch, eg:

$ gitlog-md fork/issue499

and it will spit out the commit log which you can then copy/paste into the PR description. The result is not identical to what BitBucket Cloud generates by default (it uses a format I find more informative for my own use) but you can of course modify the script to generate different output. Note by default it doesn't stop at the branch creation point, so you'll need to truncate the output at your first PR commit.

Abulia answered 20/10, 2022 at 23:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.