可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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??
回答1:
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.
回答2:
回答3:
In Visual Studio 2015, to get a diff with two non-consecutive commits:
- Make sure the two commits are on different branches
- Checkout the earlier commit, then right-click on it in Team Explorer and choose "Merge From"
- Select the later commit to merge from. Make sure the "Commit changes after merging" checkbox is NOT checked then click on Merge
- All changes will be shown between the two commits in the "Changes" view of Team Explorer. You can Abort the Merge after you're done with the diff if you wish