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.
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.
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.
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 ...
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