Using Visual Studio 2015 Update 2 and git as source control, how do you diff between 2 commits on a branch? Note that I am not talking about diff on the granular file level (ie. view history of file and comparing), but rather for entire commits.
I would expect to be able to compare when looking at the history of a branch, but the option does not exist. Here's the right click menu I see when I right click on a commit when viewing the history of a branch:
Where's the compare??
Compare commits To compare any two commits in your branch, use the Ctrl key to select the two commits that you want to compare. Then right-click one of them and select Compare Commits.
To see the changes between two commits, you can use git diff ID1.. ID2 , where ID1 and ID2 identify the two commits you're interested in, and the connector .. is a pair of dots. For example, git diff abc123.. def456 shows the differences between the commits abc123 and def456 , while git diff HEAD~1..
You can also compare two arbitrary commits in your repository or its forks on GitHub in a two-dot diff comparison. To quickly compare two commits or Git Object IDs (OIDs) directly with each other in a two-dot diff comparison on GitHub, edit the URL of your repository's "Comparing changes" page.
git diff is a multi-use Git command that when executed runs a diff function on Git data sources. These data sources can be commits, branches, files and more.
While not possible in Visual Studio 2015, this functionality will be included in Visual Studio 2017.
In Visual Studio 2017 it will be possible to get the changes between two different commits. This functionality can be accessed via selecting two commits on the history page and choosing the "Compare Commits..." command:
This functionality is present in the preview releases of Visual Studio 2017, so you can try it out and see if it is what you are looking for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With