Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

pull requests show changes which are already merged in destination branch

Vinay Talla June 12, 2024

Below is sequence of steps performed to validate missing lines in Bitbukect:

 

created clone branches for dev, stage and master as dev-XCC-2780, stage-XCC-2780, master-XCC-2780


created a local branch XCC-2780 from master and added a line "# BitBucket Missing Files XCC-2780, created branch from master" in the file "Clair-Setup/clairScanImages.sh"


merged XCC-2780(local branch) to master-XCC-2780(master clone)


created branch XCC-2780-1 from dev and made same changes as above and merged to dev-XCC-2780


also merged changes from dev-XCC-2780 to stage-XCC-2780


As above changes already merged to master-XCC-2780 from branch XCC-2780(local branch), so the pull request from stage-XCC-2780 to master-XCC-2780 should be empty but we see same changes been displayed.

1 answer

1 accepted

0 votes
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 13, 2024

Hello @Vinay Talla ,

and welcome to the Community!

From the information you have shared with us, the reason why you are still seeing these merged changes in the pull requests' diff is that back in 2022 we changed how we compute diffs in bitbucket from previously comparing both branches HEAD's, to now compute diff(topic diff) between the source branch HEAD and the common-ancestor (merge-base). The merge-base is the point in history where the branches started to diverge. This change was described in detail in the following blog post:

The fact that the diff shows previous modifications that might be already in the destination branch is simply because, from the diff point of view, they are added in the source branch.

In order to fix this disparity between the branches, you can either rebase or synch the branches on the Pull Requests page by clicking on the Sync now button in the Pull Request page.

This will merge the destination branch into the source branch and the diff will show only the "new" changes introduced by the source branch of the pull request. For more details on that please refer to How to see changes to a destination branch in a Pull Request.

Hope that helps! Let me know in case you have any questions.

Thank you, @Vinay Talla !

Patrik S

Vinay Talla June 13, 2024

Hi @Patrik S ,

Thanks for your reply it worked well, but the point is syncing the branches before merging pull request will result in loss of files or code?

Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 17, 2024

Hello @Vinay Talla ,

Great to hear that it worked! The sync between branches is actually a merge operation behind the scenes, where the new changes in the destination branch of the pull request since it was branched off are merged into the source branch.

Given that it's a merge operation, there's no loss of files or code.

Thank you, @Vinay Talla !

Patrik S

Vinay Talla June 18, 2024

Hi @Patrik S , Thanks for your reply

if possible can use provide me the what could be the base url to be used for below REST API reference:
https://developer.atlassian.com/server/bitbucket/rest/v803/api-group-sync/#api-sync-latest-projects-projectkey-repos-repositoryslug-synchronize-post

is possible to automate sync operation using api we are using Bitbucket Cloud Edition

Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 18, 2024

Hello @Vinay Talla ,

The API endpoint you linked is for Bitbucket Server, not Bitbucket Cloud.

For Bitbucket Cloud, I'm afraid there's not yet a public API endpoint to execute the Sync operation in a pull request. We do have a feature request opened with our development team to implement such an endpoint, which you can access using the following link: 

I encourage you to add your vote to that feature request to demonstrate your interest and help our product managers understand the demand. Feel free to also add yourself as a watcher in case you want to be notified by email of any future updates.

Thank you, @Vinay Talla !

Patrik S

Vinay Talla June 18, 2024

Hello @Patrik S , Thanks for your reply, i have voted the issue hope they develop the endpoint which would be much helpful.

Like Patrik S likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events