如何可视化统一差异文件中的每个字符差异

如何可视化统一差异文件中的每个字符差异

本文介绍了如何可视化统一差异文件中的每个字符差异?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 假设我使用 git format-patch 创建了一个补丁。该文件基本上是一些元数据的统一差异。如果我在Vim中打开文件,我可以看到哪些行已被修改,但是我看不到变化行中的哪些字符不同。有没有人知道一种方法(在Vim或其他一些在Ubuntu上运行的免费软件)来显示每个字符的差异?Say I get a patch created with git format-patch. The file is basically a unified diff with some metadata. If I open the file in Vim, I can see which lines have been modified, but I cannot see which characters in the changed lines differ. Does anyone know a way (in Vim, or some other free software that runs on Ubuntu) to visualize per-character differences?每个字符差异的反例可视化是当执行 vimdiff ab 。A counter example where per-character diff is visualized is when executing vimdiff a b. 更新Fri Nov 12 22:36:23 UTC 2010 diffpatch对于您使用单个文件的场景很有帮助。diffpatch is helpful for the scenario where you're working with a single file. update Thu Jun 16 17:56:10 UTC 2016查看 diff-highlight in git 2.9 。这个脚本确实是我最初寻找的东西。Check out diff-highlight in git 2.9. This script does exactly what I was originally seeking.推荐答案鉴于您在问题中引用了Vim ,我不确定这是否是你想要的答案:)但Emacs可以做到这一点。打开包含diff的文件,确保你在 diff-mode 中(如果文件名为 foo.diff 或 foo.patch 会自动发生,否则请键入 diff-mode RET ),转到您感兴趣的人群,并为 refine-hunk 点击。或者使用逐个浏览文件;这将自动完成。Given your references to Vim in the question, I'm not sure if this is the answer you want :) but Emacs can do this. Open the file containing the diff, make sure that you're in diff-mode (if the file is named foo.diff or foo.patch this happens automatically; otherwise type diff-mode ), go to the hunk you are interested in and hit for refine-hunk. Or step through the file one hunk at a time with ; that will do the refining automatically. 这篇关于如何可视化统一差异文件中的每个字符差异?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-22 15:46