You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I created a feature brunch from a tag of the master branch I made changes in one file which are also changed in the master branch. If i create a pullrequest i expect that both files (on actual master branch and the feature branch) are the same, but i get a diff wich looks like bitbucket diffs against the tag on the master branch and not the actual version. Can anybody tell me why it shows the diff?
PullRequest
File on master
File on feature branch
Network view
Hi @Jens Müller,
On the 'Create Pull Request' page and the 'Compare Branch' page Bitbucket Server shows a 'common ancestor' diff (also known as a 2-way diff). This diff finds the commit that is common to both the source and target branches (known as the common ancestor commit) and compares the latest commit on the source branch with the common ancestor commit. This means that the diff you see does not contain any of the changes from the target branch that happened after you branched.
However, if in the diff view of a created pull request Bitbucket shows the effective diff (also known as a 3-way diff). To show this diff, Bitbucket creates a temporary merge between the source and target branch, and then shows you the diff between that merge commit and the tip of the target branch. This means that the changes you are seeing in a pull request contain the changes from the target branch and represent what the target branch will look like after you perform the merge.
The article 'A better pull request' explains this concept really well.
Hope that helps!
Kristy
Also, in the example you used you will find that the pull request will have a merge conflict because both the source and the target branch modified the same line of the same file.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kristy thanks for the answer. Can you explain why there are different merge methods? it is very confusing for me.
Also it confused me that the target commit id is shown as faf836af17b which is the latest commit on master.
Also i see no information about a merge conflict. It Shows only "No changes" on the "created pull" page
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for this answer, but FWIW, I HATE this. Our team has had numerous PRs with diffs where we were sure we put a change into an env, only to see it reappear in a diff. This got us into trouble a few times, as we just assumed something was awry. Only now discovering that BB renders the diff for a PR differently than a diff for a branches comparison.
While I don't understand this, I really would prefer some note in the UI or some setting to specify which we prefer. In our case, the 3-way diff is NOT what we want.
PS I am talking about BBCloud, not BBServer, which has the same/similar problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For anyone reading this post v7 (2020):
unfortunately Bitbucket disabled 3-way diff in v7 resulting in "incorrect" diff mentioned in this question to becomes new standard, i.e. 2-way diff.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.