If you tdd, you will write the test for the new code while the old code is still available, and you will use the test as a guide rather than the old code.
Even if you don't tdd, I would say that typically if you understand the code well enough to make a change, you should be able to write a replacement without referring to the old code. The diff should fit in your mind, so to speak. There are some exceptions, like when you're modifying a regex or some dense, opaque shell command, but in the course of modifying typical code I can't see a live diff being that useful to me