Skip to content

Commit 5fa8a61

Browse files
timotheecournarimiran
authored andcommitted
add git diff hints to help with reviews (#10435)
1 parent 91b39f2 commit 5fa8a61

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

doc/contributing.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,26 @@ Code reviews
410410
saves time explaining the change or applying it; see also
411411
https://forum.nim-lang.org/t/4317
412412

413+
2. When reviewing large diffs that may involve code moving around, github's interface
414+
doesn't help much as it doesn't highlight moves. Instead you can use something
415+
like this, see visual results `here <https://github.com/nim-lang/Nim/pull/10431#issuecomment-456968196>`_:
416+
417+
.. code-block:: sh
418+
419+
git fetch origin pull/10431/head && git checkout FETCH_HEAD
420+
git show --color-moved-ws=allow-indentation-change --color-moved=blocks HEAD^
421+
422+
3. In addition, you can view github-like diffs locally to identify what was changed
423+
within a code block using `diff-highlight` or `diff-so-fancy`, eg:
424+
425+
.. code-block:: sh
426+
427+
# put this in ~/.gitconfig:
428+
[core]
429+
pager = "diff-so-fancy | less -R" # or: use: `diff-highlight`
430+
431+
432+
413433
.. include:: docstyle.rst
414434

415435

0 commit comments

Comments
 (0)