How to make quick edits in the diff view in Visual Studio – 067

I always assumed that if you’re diff’ing the working directory against the last commit (i.e. Compare with Unmodified), both sides of the diff would be read-only. Turns out, only the last commit (left-hand side) is read-only.

For example, suppose you’ve made some quick edits in Program.cs (see yesterday’s tip), and you’ve opened the diff in the Editor by right-clicking and clicking Compare with Unmodified, you can still make edits on the right-hand side.

Added a new line of code on right-hand side

In this example, I’ve added a Console.ReadLine(), as anyone who has ever created a throwaway console app knows why. (I thought at one point in VS 20 year history if you switched from debug to release, the console app persisted until you closed it, but it looks like that’s no longer the case)

As soon as you hit save, you can confirm via the command line that Visual Studio is being honest that you can edit changes on this right-hand side.

git diff confirming changes to right-hand side

One thought on “How to make quick edits in the diff view in Visual Studio – 067

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s