DEV Community

harleybl
harleybl

Posted on

Diff GIT stash versus working directory in Visual Studio 2019

Have you previously stashed some code using git stash and want to see what applying it would do to your workspace?

I had this happen today and my first thought was to reach for "git stash show -p" on the command line. While this is a useful command for a small stash it is not that easy to see the changes in a pretty side by side manner.

The project I am working on is a C# project and I am already using Visual Studio 2019 for the project so I was wondering if there was a way that the tool could help me. Sure enough, the Visual Studio team has already thought of this.

To view a stash within Visual Studio, follow these steps:

  1. Open the Team Explorer
  2. Go to the Changes View within Team Explorer.
  3. Double click on the Stash in the stashes section (below Changes)

This will open up the stash details and allow you to see the files contained in the stash. To see the differences of a specific file in the stash, double click that file to see the difference between the stash and your workspace.

I found this useful, hopefully others will find it useful as well.

Top comments (0)