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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Understanding the diff between two branches in a pull request ?

Say that a pull request is created in bit bucket to merge branch-2 into branch-1. The pull request has a diff tab to show the difference between these branches. I'd like to know the order of the comparison in the diff tab. Is it like git branch-1 branch-2, OR is it git branch-2 branch-1 ? Thanks.

1 answer

1 accepted

3 votes
Answer accepted

Hello @Borat Sagdiyev,

Thanks for reaching out.

It is neither of these commands, actually. In a pull request Bitbucket shows the difference between the potential merge state and the target branch. Here's a nice blog post describing this and the reasons behind (it is almost 5 years old now but still totally valid).

So the pseudo command is rather something like this:

git diff branch-1 <merge of branch-1 and branch-2>

Does this make sense? Let me know if you have any questions.

Cheers,
Daniil 

Thanks @Daniil Penkin - I have a pull request in bit bucket in which all lines of many files appear as changed (in bit bucket and source tree). When I use "git diff branch-1 branch-2", I see that each line has a "^M" character at the end. Hence, it appears as if there are many changes when there is essentially no change. I want to know which branch added the "^M" character, which is why I asked this question. So, can we say that branch-2 has introduced the "^M" character ?

If the diff shows ^M in the added line (marked with a + and highlighted with green color) and not in the removed line (marked with a - and highlighted with red color), – then yes, that character was added in one of the commits on the branch-2.

You can also switch to the side-by-side diff which might surface in a cleaner way.

^M is the carriage return character from Windows end-of-line sequence. Git client can be configured to handle this on the fly.

Hope this helps.

Cheers,
Daniil

Like Borat Sagdiyev likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,886 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you