VS Code Cheat Sheet/Open a diff view from the CLI

Compare two files in VS Code.

Section: Search, Terminal, and CLI

Open a diff view from the CLI

bash
bash
code --diff old-file.ts new-file.ts

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Search, Terminal, and CLI
Open current folder in VS Code
Launch VS Code from a shell.
OpenIn sheetbashsame section
Find in current file
Search inside the current editor.
OpenIn sheettextsame section
Find in files
Search across the whole workspace.
OpenIn sheettextsame section
Toggle regex search
Enable regular expressions in search UI.
OpenIn sheettextsame section
Toggle integrated terminal
Open or focus the integrated terminal.
OpenIn sheettextsame section
Open Command Palette
Run any VS Code command quickly.