Sublime Forum

Can Sublime Merge show diffs between branches?

#1

I commonly find myself running commands which compare branches to each other, along the lines of:

git diff my/current/branch another/branch/to/compare

However, I haven’t yet found a way to do this with Sublime Merge?
Is this possible at the moment? It would really be handy to generate and view the complete diffs between branches.

Another common one is simply git diff master to show the changes between the current branch and the master branch.


If this is already possible, can someone please show me how? :sweat_smile:
If this isn’t currently possible, then I suppose this is a feature request!

1 Like

#2

Cmd/Ctrl + click on two commits, see also https://github.com/sublimehq/sublime_merge/issues/255

6 Likes

#3

@srbs that indeed does work! Thank you.

I think that a specific command for this would also be great. Perhaps it could be implemented as a plugin in the future. :man_shrugging:

2 Likes

#4

The above no longer works in build 1119 - only changes from the first commit are shown.

Now it has to be done by:

  1. click on the base commit
  2. shift-click or ctrl-cmd-click on commits where you want the changes to show.
1 Like

#5

This is a major omission. If I can git diff master in a terminal, why doesn’t something equally simple work in Sublime Merge? (Build: 2056, Mac). I don’t care if it is a menu command, context menu, etc. It should be easily discovered by a new Merge user.

I’ve tried all manner of Cmd+click combinations between commits and branches as suggested in various threads, without success. For now, I’m sticking with creating disposable PR’s in Bitbucket to do what should be a simple local command.

1 Like

#6

Here’s a demonstration:

4 Likes

#7

The current solution works @bschaaf, but I would love it to be able to do that from the Branches panel ! (Location tab, Branches section)
It would be useful for example when the branches are really spaced our on the Commits tab

0 Likes

#8

I’m wondering if the direction of the compare can be reversed? Looks like I am not able to get that working… on the CLI, it’s a different thing when you do

git checkout branch1
git diff branch2

git checkout branch2
git diff branch1

However, regardless whether I click branch1 and then cmd-click branch2 or the inverse, I always get the same change set. Also tried with both branches explicitly checked out to ensure the same starting point as via CLI… What am I missing?

Build 2074 on Linux w/ git 2.34.1, fwiw.

1 Like

#9

Hi @rschmied,

It’s currently not possible to reverse the direction of the diff (it will always diff from the oldest to the newest commit), though it’s something we’re definitely looking to improve.

Kind regards,
- Dylan from Sublime HQ

5 Likes

#10

Ahh! That explains it… so, no PEBCAK but a missing feature! looking forward to have that implemented! Thanks :+1:

0 Likes

#11

hello @djohnston, has this been implemented yet? i use diffing between branches a lot, but not being able to change the diff direction makes this almost useless to me.

nonetheless a great sublime merge fan here! thank you

2 Likes

#12

For me this is the single most glaring missing feature in Sublime Merge.

I think that when the user Ctrl/Cmd+Clicks two commits on different branches (one is not a direct ancestor of the other), you should ignore the dates and instead pick as the “base” branch for the comparison the branch that the user has currently checked out.
If neither (or both) commits are on the current branch, then the base should be the commit that the user cliked first.

I think this would feel instantly intuitive to most people (unlike the current behavior).
To aid their understanding you could maybe color-code the two selection points in the history tree, and then provide some visual hint as to which direction the comparison goes.

Comparing [purple] Base SHA <-- [green] Compare SHA

1 Like

#13

Agreed. I used this feature all the time in Git Extensions and it’s really frustrating to not be able to choose the diff direction in Sublime Merge.

0 Likes