Email or username:

Password:

Forgot your password?
Julia Evans

I really love diffdiff.net for quickly looking at diffs -- it does a great job of highlighting diffs inside a single line

used it yesterday to debug a networking issue by diffing two tcpdump outputs and it was SO helpful, it made it immediately obvious that the MSS was different between the two connections

(the screenshot isn't the actual bug, just a diff of two tcpdump outputs)

28 comments
Julia Evans

@learnbyexample thanks! it does pretty well though the output is a little weird for numbers

DELETED

@b0rk @learnbyexample

The diffdiff presentation is clearly better.

This could be a good suggestion to Jeff.

Zack Weinberg

@b0rk piping diff -u output to `wdiff -d -t | less` is the closest approximation i can think of this morning

Zack Weinberg

@b0rk wdiff is also handy on its own for comparing two versions of something that isn't structured into lines in the first place, like text in a human language

January's Commission

@b0rk I've never had trouble reading `nvim -d $A $B`. Pretty good indication of what's changed (may depend on your color scheme for specifics of rendering), side-by-side, synced scrolling, plus you can use all of vim navigation, if that's something one is familiar with.

Julia Evans

@deoxys314 yea that was the first thing I tried, sadly on this particular input `nvim -d` doesn't really help at all for some reason

January's Commission

@b0rk Ah, that's basically useless! Maybe the timestamps are tricking it up. I think you can mess a little with the diff alg, but I've never looked into it; the default is fine for me looking at git diffs, which is 99% of my use case.

January's Commission

@b0rk I mean you could do some awk and trim things off and so on, but that does seem to be reaching the level of "there's a better tool for the job".

Tom Swartz

@b0rk Personally, I'm a fan of Meld (meldmerge.org/) it works well for somewhat complicated comparisons, and even can be used as a diff-tool for git!
It does have a tendency to bog down and get sluggish on very large files, though

vfig (aka leviathan_bound)

@b0rk i dont believe "git diff" will do a side by side compare, but i use `git diff --word-diff=color` pretty often, so that it highlights word changes instead of whole lines.

if you add `--no-index` you can diff two files against each other regardless of whether they are in a git repo or not.

Nick

@vfig @b0rk I do this too, mostly because it already exists on many questions these days, so I don't have to install anything or have internet access. I also sometimes use --word-diff-regex to change the concept of a word (e.g. if I want to look for single character changes).

Bill Mill

@b0rk Here's what delta looks like for me, it seems to provide what you're looking for?

Bill Mill

@b0rk I don't have a very fancy config, this is it: github.com/llimllib/personal_c

the zshrc function referenced just controls setting it side-by-side on larger terminals but not narrower ones: github.com/llimllib/personal_c

Julia Evans

@llimllib hmm this is what I get from delta for my input

Bill Mill

@b0rk It looks like `max-line-distance` is the config for when delta considers two lines to be same-but-changed as opposed to new lines.

If you gist it I could play around with the settings a bit?

dandavison.github.io/delta/ful

Bill Mill

@b0rk Interesting! delta with no options set works for me.

(I initially tested on delta 0.17.0, noticed that there was a newer version, and it works unchanged on 0.18.2)

edit: I had to drop `--max-line-distance` down to 0.1 to reproduce the behavior you're seeing

Julia Evans

@llimllib weird! I tried with (I think) the exact same versions and command line arguments but I get the same thing as before

Bill Mill

@b0rk I'm stumped! Do the `--diff-highlight` or`--diff-so-fancy` arguments change anything?

Here's my `delta --show-config`: gist.github.com/llimllib/1c4dd

Lindsey Kuper

@b0rk I use `git diff --color-words`, whether I'm in a git repo or not

Lindsey Kuper

@b0rk I never do this, but for a side-by-side diff, try

git difftool --tool=vimdiff --color-words --no-index <path> <path>

(You can usually leave out `--no-index` with git-diff (according to the docs, "You can omit the --no-index option when running the command in a working tree controlled by Git and at least one of the paths points outside the working tree, or when running the command outside a working tree controlled by Git"), but with git-difftool, apparently you do still need it)

Julia Evans

@lindsey hm that doesn't work for me but other than the side by side thing `git diff` seems to do the best job of anything anyone has suggested so far

Lindsey Kuper

@b0rk hmm, here's what I get. you could probably tell git-difftool to use something else that shows files side by side, if vimdiff is the problem for you

a side-by-side diff of two files using vimdiff, highlighting changed wors
VZ

@b0rk git-diff can be used with the files outside of the repository and you probably already know about its --color-words option.

Otherwise there's github.com/ymattw/ydiff and is multiple forks called cdiff.

bew :nixos:​:neovim:

@b0rk `git diff --no-index before after` can be nice too, if you have configured a nice diff pager like delta!

Go Up