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?
A counter example where per-character diff is visualized is when executing vimdiff a b
.
update Fri Nov 12 22:36:23 UTC 2010
diffpatch is helpful for the scenario where you're working with a single file.
update Thu Jun 16 17:56:10 UTC 2016
Check out diff-highlight in git 2.9. This script does exactly what I was originally seeking.
git diff --color-words
is very useful for just seeing what words have change within lines, rather than the usual unified diff output. It is word-based rather than character-based, though, so if there's not much whitespace in the content you're diffing then the output may be less neat. (Edited: Oops, I see that I misunderstood what you're asking for - nevertheless maybe this comment would be useful to someone.) – Partite