[VS Code] Open a diff from the command line

Created on November 28, 2026

You can use the -d or --diff option of the code command to open a file diff in VS Code from the command line. The following command opens VS Code and shows the differences between a.html and b.html.

code -d a.html b.html
VS Code