【发布时间】:2017-11-06 16:34:33
【问题描述】:
如果我有这个文件
def main():
foo
bar
baz
quux
corge
我把它改成
def other():
foo
bar
baz
def main():
other()
quux
corge
我真的很想看看差异
+def other():
+ foo
+ bar
+ baz
+
def main():
+ other()
- foo
- bar
- baz
quux
corge
但是git diff 给了我
-def main():
+def other():
foo
bar
baz
+
+def main():
+ other()
quux
corge
(使用它提供的每个 diff 算法、耐心、最小、直方图和myers)。有没有办法说服它生成语义上更清晰的差异?
【问题讨论】:
-
afaik 不在命令行中,但您可以在浏览器中切换差异拆分/差异统一:github.com/blog/1884-introducing-split-diffs 这也可能是有用的信息:stackoverflow.com/questions/27350678/…
-
尝试添加
--diff-algorithm=patience。我不知道它在这种情况下是否会起作用,但这是它想要改进的某种东西。 -
@Mort 遗憾的是,在这种情况下它不是,但感谢您的建议。