How to read diff result: Difference between revisions

From 清冽之泉
Jump to navigation Jump to search
No edit summary
No edit summary
 
(30 intermediate revisions by the same user not shown)
Line 1: Line 1:
<graphviz>
在各类代码阅读过程中,diff 结果可谓至关重要。本图讲述怎样读懂 diff 后生成的结果。其中 git diff 形式是最应该引起注意的。
graph diff {


"5C7" [shape=record; label="{<1> 5 | <2> c | <3> 7}"]
[[File:读懂 diff 20250117.png|1200px]]
"5C7":1 -- 第几行有变动
"5C7":2 -- 具体变动
"5C7":3 -- 变动后是第几行
 
}
</graphviz>
 
 
digraph G {
  rankdir=LR;  // 设置布局方向为从左到右
  node [shape=record];
  node0 [label = "<f0> |<f1> |<f2> |<f3> |<f4> |<f5> |<f6> | "];
  node1 [label = "{<n> n14 | 719 |<p> }"];
  node2 [label = "{<n> a1 | 805 |<p> }"];
  node3 [label = "{<n> i9 | 718 |<p> }"];
  node4 [label = "{<n> e5 | 989 |<p> }"];
  node5 [label = "{<n> t20 | 959 |<p> }"];
  node6 [label = "{<n> o15 | 794 |<p> }"];
  node7 [label = "{<n> s19 | 659 |<p> }"];
  // 连线
  node0:f0 -> node1:n;
  node0:f1 -> node2:n;
  node0:f2 -> node3:n;
  node0:f5 -> node4:n;
  node0:f6 -> node5:n;
  node2:p -> node6:n;
  node4:p -> node7:n;
}

Latest revision as of 09:07, 17 January 2025

在各类代码阅读过程中,diff 结果可谓至关重要。本图讲述怎样读懂 diff 后生成的结果。其中 git diff 形式是最应该引起注意的。