For each defect in code I create separate branch. When defect is fixed I merge this branch in master, so I have history like illustrated below (we see two branches with fixes):
defect1 fix defect2 fix
a---b---c---d e---f
/ \ / \
---o---1---x---y---z---2---o---3---w---4---o---
The question is how to get diff for fix1 (between branch start (1) and branch end (2)) or fix2 (diff between (3) and (4)) at any point of time (e.g. for any closed defect in past).
Update: actual question is how to figure out SHA summs of a and d or e and f to perform next obvious diff command diff <commit> <commit>
The answer is simple:
This shows the differences between the branching point of your
defect1 fixbranch (i.e.1) and it’s end (i.e.d).In order to find the start of the
defect1 fixbranch, useas indicated in this answer: https://stackoverflow.com/a/2458173/520162.
This gives you
1according to the documentation ofgit merge-base.The end of the
defect1 fixbranch is simply identified by it’s name. So, finding all differences introduced indefect1 fix, you need to do