How to compare two commits in BitBucket?
I was trying to compare two commits on the same branch (master in this case) in BitBucket and did not find a good answer in any forum, so decided to try their client, SourceTree to see if installing it locally would help and it did.
Therefore, thought it might be useful to add question and answer here.
Solution 1:
BitBucket Cloud (bitbucket.org) supports commit comparison on the branch compare page:
- Navigate to a repo
- Click the '+' menu in the left-nav
- Click 'Compare branches and tags'
- Paste your commit hashes into the search fields in the branch/tag dropdowns
- Click 'Compare'
Solution 2:
This URL worked for me: https://bitbucket.org/<OWNER>/<PROJECT>/branches/compare/<commit1>..<commit2>#diff
, short hashes can also be used.
Screenshot:
Solution 3:
I came across this question while looking for a way to compare a single file across two different commits. The instructions for doing so are slightly different than those above, so I wanted to share:
- Browse to the file in question in the "Source" view
- Drop down the file's view option and select "Diff":
- Once the file's diff has loaded, drop down the history options and select the commits that you want to compare between: