shortcut to show git diff with origin master when working on a different branch with intellij

Viewed 2216

I tend to check git diff with origin master using intellij many times a day and it has become a laborious task for me.

I use git diff tool provided by intellij...as suggested here: https://stackoverflow.com/a/49642681/2960555

Is there a way to add shortcut for this manual steps.

3 Answers

As I see, you can assign a shortcut for Compare with Branch..., but not automatically select the origin/master or any other branch.

To make it, go to Settings (Ctrl + Alt + S) → Keymap, select Version Control SystemsGitCompare with Branch..., right click on it and select Add Keyboard Shortcut.

enter image description here

Since you need to check the diff often, a permanent view that shows the diff might be helpful. Starting with 2019.2 there is something that could help.

Since 2019.2 Branches filter in the Log tab supports ref1..ref2 filter that shows commits present in one branch but missing from another. So you can have a Log view that shows the diff between your current branch and master using the HEAD..master (commits of your current branch not present in master) or master..HEAD (commits of master not present in current branch) filter.

Log tab

To have the view always available, just create a second Log tab (highlighted 2 on the above). ANd from this view, you could call Compare with local on any revision to get the list of files that are different between your working tree and corresponding revision.

Compare with local

BTW, you can assign a shortcut to the Compare with Local

(Ctrl + Alt + S) → Keymap, select Version Control Systems → Git → Compare with the Same Repository Version, right click on it and select Add Keyboard Shortcut.

That works for me ;)

Related