amphibient
amphibient

Reputation: 31248

How to diff two commits (patches) to the same change in Gerrit?

I have two patches to the same commit in Gerrit. The first was made explicitly as a patch (amendment) to the change but the second one came from another change that was built on top of that change and got approved and merged before this change. So I need to produce a diff between the two patches. What makes it more difficult is that they were actually pushed from two different local git branches (I have a habit of forking a new branch for each commit I'll be sending to Gerrit).

So my question is: how to diff two commits (patches) to the same change in Gerrit?

Upvotes: 4

Views: 12661

Answers (4)

Facepalmed
Facepalmed

Reputation: 761

It is easy. If you want to show diffs between patchsets just go to "Files" section and look for "Diff against:" - see red box in the image-. It will show you the differences between your current patchset against the patchset you select in the combo - see the blue box - enter image description here

If you need to compare between different old patchsets, just go to "Patch Sets" (usually at the right top corner of the screen), select one of the old patchsets and then repeat the process with "Diff against".

Upvotes: 7

Aravind Nadumane
Aravind Nadumane

Reputation: 190

Try

git review -m <CHANGE_NUMBER>,<OLD_PS>[-<NEW_PS>]

But git review AFAIK above git version 1.25.x.x.

Upvotes: 2

laplasz
laplasz

Reputation: 3497

first fetch the submitted change (git fetch) then checkout the first change, then use git diff origin/<branch> where the submitted commit was merged

Upvotes: -1

StephenKing
StephenKing

Reputation: 37620

In the diff screen, select a different version instead of Base in the Patch Set selector.

Upvotes: 6

Related Questions