Reputation: 1084
Let's say I made a pull request against a branch called temp
. My commits are c1
, c2
and c3
. How to get the diff for the that PR?
I can use git diff HEAD~3 HEAD
but if I don't know I am 3 commits ahead of temp
, how do i do that? How to do on Jenkins? using variables like env.BRANCH_NAME
?
Upvotes: 0
Views: 913
Reputation: 30868
git diff temp...HEAD
It is equivalent to git diff $(git merge-base temp HEAD) HEAD
.
Suppose the history of temp
is A-B-C-D-E
and the one of HEAD
is A-B-c1-c2-c3
. git merge-base temp HEAD
is B
and git diff B HEAD
is the combined diff of c1
, c2
, and c3
.
Upvotes: 2