This is a silly one, but I always forget about this until I need it and then stumble across it again.

The scenario: you’ve just updated a piece of software and it comes with a new sample configuration. Being the good admin that you are of course you want to your config to reflect it, you’re not a monster. But you want to keep the settings you’ve tweaked.

I always end up with a mess of patch files trying to do things, but all you really need is your favourite editor. Both emacs and (neo)vim have a diff editor mode. I bet other editors do too.

So instead, do this: nvim -d <orig> <updated>. You’ll get a nice diff view, with the left pane being the file you want to update. Move through the file and hit do for any change you want to pull across. Add your own tweaks. Save, exit, done.