Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to export the compared difference of two files as text or HTML in Visual Studio Code?

Visual Studio Code has built-in function to compare the difference of two files on the UI. enter image description here

I am using VS Code on Windows. Is there a convenient way to export the difference into a text or HTML file, like using the unix shell command diff or vimdiff ?

like image 763
yhd.leung Avatar asked Nov 28 '25 09:11

yhd.leung


1 Answers

Not specifically using VS Code:
Export to HTML, if the Windows can run the vimdiff shell command:

vimdiff -c TOhtml -c "w vimdiff_export.html | qa!" file1 file2

Export to text using diff:

diff file1 file2 > diff_export.txt

Or use the Windows command line fc (file compare) command:

fc file1 file2 > fc_export.txt
like image 126
yhd.leung Avatar answered Dec 01 '25 15:12

yhd.leung



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!