Reputation: 674
Im using git. Say we have a common branch that multiple people are working on. A rather large change is being done, say it has 20 commits and a considerable amount of lines changed. Now say the "change" / "feature" / "fix" being done is identified with a commit-message. So that in the git-log, the commits look like:
TASK-X: Add foo.
TASK-Y: Added rofl.
TASK-X: Added bar.
TASK-X: Added baz.
Now, imagine this at a much larger scale. Imagine huge amounts of commits being done in between each other. And someone now tells me "Do a code review on TASK X".
I can easily find all the relevant commits - but say a lot of the commits contain stuff like "Added debug statements", "Removed debug statements", "Fixed a bug in my code" etc.
Going through commit by commit would be very tiresome, as I might notice errors that have been fixed in a later (upcomming)commit, and I also lack the context of the commits in their entirety.
Is there a way of showing the combined/consolidated commits for task X, but not include all other non-relevant commits done in between?
PS: I know that a better way is doing feature branches, and forcing people to cleanup their own mess before merging, but I can't do anything about that.
Upvotes: 0
Views: 499
Reputation: 39981
You could create a (temporary) review branch based on the commit just before the first commit for TASK X
git branch review-TASK_X <first commit for TASK X>^
Then cherry-pick all commits for TASK X one by one
git cherry-pick <first commit for TASK X>
git cherry-pick <second commit for TASK X>
....
git cherry-pick <last commit for TASK X>
Then simply diff this branch between its HEAD and its branch point
git diff <first commit for TASK X>^
Upvotes: 1