Reputation: 31
Intellij has a great way of presenting the diff between two git branches with the Compare tool.
However, this seems to correspond to a
git diff branch1..branch2
Is there a way to perform
git diff branch1...branch2
(with three dots)
Upvotes: 3
Views: 2131
Reputation: 6580
I've found a method that's ok but not perfect.
Right click on the project -> Git -> Compare With...
Then on the File Revisions dialog choose the top-most commit that's not part of this branch. That can be hard to determine, but there's a good chance it's the first one by another author. For example, if this were the File Revisions history:
d4c3af today Craig
c3af21 today Craig
b2af3a yesterday Bob
a1af73 two days ago Alice
and if I knew I was reviewing Craig's branch, I'd pick Bob's commit. Then IntelliJ gives me a diff for just changes in Craig's branch.
Upvotes: 0
Reputation: 190
There is another way to see changes in Intellij Idea as would be seen in three-dot git diff.
I will describe my case when I needed three-dot diff. There was large pull request on github that I needed to inspect. Branch F(eature)
was branched out of M(aster)
, some changes were made to both, then some changes from M(aster)
were already merged into F(eature)
. Now after more changes I want to merge F(eature)
into M(aster)
.
F -> M
| |
* *
| |
* *
|\ |
| \ |
| \ |
* * <- X
| |
* *
\ |
\ |
\ |
* <- P
git diff master...feature > diff
Checkout commit X
In Idea, open the Apply patch dialog and choose the file created at step 1
Now you will see Apply patch dialog with changes similar to those you would see in github pull request
You cannot change anything in branch F(eature)
You cannot see who committed changes
You cannot compile/run until you apply the patch
Upvotes: 1
Reputation: 7474
I've read the docs on IntelliJ, searched the options on the VCS and found nothing to specify options to the diff.
From reading up the documentation on diff
I can only suggest for you navigate to the merge-base, checkout another branch and do the diff
, like:
Assuming:
branch1
is the mainlinebranch2
was branched off branch1abc123
is the merge-base of branch1
and branch2
Do:
git checkout abc123
git checkout -b branch1-temp
Then go to IntelliJ and compare those two branches. Otherwise just use the command-line ...
notation.
Upvotes: 1