I spent like 3 hours yesterday deduplicating two functions that were hundreds of lines long and nearly identical. I should probably learn how to use that git command that can diff two files on disk. Luckily I actually enjoy cleaning up code sometimes.
I spent like 3 hours yesterday deduplicating two functions that were hundreds of lines long and nearly identical. I should probably learn how to use that git command that can diff two files on disk. Luckily I actually enjoy cleaning up code sometimes.
That’s what the
diff
tool is for.If you’re using a decent development system, you’ll have an executable called
diff
installed already :)VS Code’s diff tools are killer. Comparison is smarter than most, and you can edit either file as you go.
And if you want to avoid the Microsoft stank, there’s VS Codium that has been de-Microsoft’d, like Chrome vs. Chromium.
If you use VSCode, open both files and then ctrl-shift-P “Compare active file with …”
You’re welcome.
Thank you! I love VS Code
You can use a diff app directly such as meld which is free. Highly recommend.