To compare any two files and merge it to one file, here are the following steps you can follow if you have Visual Studio (any version) installed.
Step 1: Open the Visual Studio command prompt. If you do not find the Visual Studio command prompt then choose Visual Studio tools
Start → Visual Studio command prompt


Step 2: Enter the command vsdiffmerge.exe
Ignore the switch /m if you need just comparison.
Syntax 1:
vsdiffmerge <file1> <file2> <file1> <outputfile> /t /m
Syntax 2:
vsdiffmerge <basefilename> <CompareFilename> <basefilename> <OutputFilename> /t /m
Example 1:
vsdiffmerge test1.js test2.js test1.js output.js /t /m
Example 2:
vsdiffmerge.exe "C:\Users\livingston\Downloads\wa\wa\Files\pre\Test.js" "C:\Users\livingston\Downloads\wa\wa\Files\Prod\Test.js" "C:\Users\livingston\Downloads\wa\wa\Files\pre\Test.js" "C:\Users\livingston\Downloads\wa\wa\Files\output\samp.js" /t /m

Step 3: Merge the files

Please note that if file name does not exist in the location, it will not open the comparer.
Also you can beautify the file before you do the comparison. In Visual Studio, Ctrl + K + D.
There are a lot of beautifier sites available online.