diff options
author | Sjors Provoost <sjors@sprovoost.nl> | 2019-02-19 17:15:38 +0100 |
---|---|---|
committer | Sjors Provoost <sjors@sprovoost.nl> | 2019-02-19 17:15:38 +0100 |
commit | ff7f31e07dff676a3bb400e98e0e365eee5aace9 (patch) | |
tree | 635ec0abc0a5d69327500343fd373c13c37c3c51 /doc/productivity.md | |
parent | 3a21905a4ef7d98c8762ec89affa2667e197a118 (diff) |
[doc] productivity: more advanced git range-diff
Diffstat (limited to 'doc/productivity.md')
-rw-r--r-- | doc/productivity.md | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/doc/productivity.md b/doc/productivity.md index f94bf8da6a..e0df558944 100644 --- a/doc/productivity.md +++ b/doc/productivity.md @@ -136,7 +136,7 @@ This will add an `upstream-pull` remote to your git repository, which can be fet ### Diff the diffs with `git range-diff` -It is very common for contributors to rebase their pull requests, or make changes to commits (perhaps in response to review) that are not at the head of their branch. This poses a problem for reviewers as when the contributor force pushes, the reviewer is no longer sure that his previous reviews of commits are still valid (as the commit hashes can now be different even though the diff is semantically the same). `git range-diff` can help solve this problem by diffing the diffs. +It is very common for contributors to rebase their pull requests, or make changes to commits (perhaps in response to review) that are not at the head of their branch. This poses a problem for reviewers as when the contributor force pushes, the reviewer is no longer sure that his previous reviews of commits are still valid (as the commit hashes can now be different even though the diff is semantically the same). [git range-diff](https://git-scm.com/docs/git-range-diff) (Git >= 2.19) can help solve this problem by diffing the diffs. For example, to identify the differences between your previously reviewed diffs P1-5, and the new diffs P1-2,N3-4 as illustrated below: ``` @@ -152,7 +152,19 @@ You can do: git range-diff master previously-reviewed-head new-head ``` -Note that `git range-diff` also work for rebases. +Note that `git range-diff` also work for rebases: + +``` + P1--P2--P3--P4--P5 <-- previously-reviewed-head + / +...--m--m1--m2--m3 <-- master + \ + P1--P2--N3--N4 <-- new-head (with P3 modified, P4 & P5 squashed) + +PREV=P5 N=4 && git range-diff `git merge-base --all HEAD $PREV`...$PREV HEAD~$N...HEAD +``` + +Where `P5` is the commit you last reviewed and `4` is the number of commits in the new version. ----- |