DEV Community

Kenneth Lum
Kenneth Lum

Posted on

To diff two files side by side, without opendiff, Microsoft Visual Studio Code, Perforce diff works too

opendiff can be large, because XCode is required to run, depending on your platform, and it can take a good 35GB or more. But if you already have Microsoft Visual Studio Code, we can first add it to the command prompt by bringing out the command palette, type in shell, and choose

Install 'code' command in PATH

and then in Bash or Zsh, it can be

code --diff file1.js file2.js
Enter fullscreen mode Exit fullscreen mode

or just use -d

code -d <path1> <path2>
Enter fullscreen mode Exit fullscreen mode

Perforce diff can be used as well, and it'd be smaller size than opendiff

Discussion (1)

Collapse
verious profile image
Verious

Visual Studio
use the Developer Command Prompt, so the proper paths and environment variables are loaded

devenv /Diff <path1> <path2>
Enter fullscreen mode Exit fullscreen mode