views:

51

answers:

1

I have around 50 relevant commits on my local git repo, of this list I want to show in a code review only my commits.
But they are mixed with other people commits, and some of my commits are corrections to others, so I don't want to go commit by commit because I would step twice in the same code, for the original and for the correction.
The best thing for me would be to do something like this:
git combine-commits 4 9 20 35 67 90 102 > myfile.diff
In such a way that 67 fixes an error on 20 and the diff shows the corrected version.

Is there any way of geting this?

+3  A: 

One way would be to create a new working branch based at a point before the oldest commit you want to include, git cherry-pickthe commits you want to review onto that branch and extract the diff from the new branch (just git diff start-ref when you have your temporary branch checked out). Once you've finished the review you can throw away the temporary branch. One thing to watch out for is that the sha refs on your temporary branch will be different to the ones you started with, but I don't expect that will be a problem.

Andrew Walker