Things I Learned (2022-2)

less than 1 minute read til learning   vscode Comments

Like many, I'm also a huge fan of Visual Studio Code and use it frequently. This blog is written in VS Code, and I'm far more likely to fire it up for a new project than I am full Visual Studio. As I mentioned in a previous post, I spend a lot of time at the command line, so when I'm working on a project, I'll navigate to the project folder, then open VS Code using

code .

During the course of my work, I need to diff files. It may be using vimdiff during a merge conflict, or a more specialized tool like Beyond Compare when I'm comparing directories or just pasting text in instead of opening files, but it turns out there's another way!


I learned that you can open a diff in VS Code by doing

vscode --diff filename1 filename2

So, if I want to diff two files within this blog project, it would look like this:

Entering code dash dash diff links.html til.html at the command line
Opening a diff in VS Code from the command line
and the result in Visual Studio Code would look like this:
Visual Studio Code displaying a diff
A diff in Visual Studio Code