gitkraken - How to compare 2 branches

Viewed 29621

Is there any way to compare 2 branches (branch1 and branch2) with gitkraken?

I want a list of files that have changes

6 Answers

If you want to find out difference between branch A and B First checkout on branch A then click on branch B and select commits it then you can find changes on right panel.

and can select multiple commit rows in the graph using Shift Click to show its merged diff

GitKraken, as far as I know after some looking into that matter, doesn't let you compare branches regarding their commits. One way to do what you want though, is to use Soloing; you right-click the first branch you want to compare and choose 'Solo'. Orange circles will appear to the left of the branches names instead of the eye. Then click the faded orange icon next to the second branch you want to solo. Only those branches will be shown in the commit view.

Then you just select one commit, and click the second while holding Shift. The list of changed files will appear on the right. Clicking on a file will also show you the diff of contents.

It's worth mentioning though that you can't set the direction of the diff (source and target branch) ; but this has helped me to find out what's changed between two branches.

I don't know if this feature is recent, but it is very simple in GitKraken now to display the diff of 2 branches.

You just have to click on the commit of the first branch, hold Shift key, and click to the second commit, which can be anywhere so for example a commit of the second branch.

You can solo the 2 branches for simplifying the graph before to do this action.

There are two different ways I examine differences between two branches:

  • Use "git difftool branch1..branch2" where I have my difftool specified to be a graphical tool (I typically use xxdiff).

  • The other method (probably easier) is to use the compare branch functionality in the most excellent Visual Studio Code. See here for additional detail: How to compare different branches in Visual Studio Code

I want a list of files that have changed

git whatchanged

  • You can always use the command line and use the git whatchanged command. Full documentation can be found at https://git-scm.com/docs/git-whatchanged.
  • This command supports many of the git log flags so you can use them as well

enter image description here


based upon the comment:

let's say that 2 coworkers work at the same bug... and you want to compare the 2 branches.... to find the best solution (real example)

There are few ways to find differences between 2 branches:

**In case you get empty result swap the branches

  • git diff <branch1>...<branch2>
  • git diff <branch1> ^<branch2>
  • git log <branch1>...<branch2>
  • git whatchanged
Related