Diff between commits in Visual Studio 2015 using git

后端 未结 3 809
醉酒成梦
醉酒成梦 2021-01-07 18:20

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 fil

相关标签:
3条回答
  • 2021-01-07 18:53

    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.

    0 讨论(0)
  • 2021-01-07 18:54

    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
    0 讨论(0)
  • 2021-01-07 19:16

    Don't know about VS 2015 update 2. But, in update 3, you can...

    1) Right click a commit from history and select View Commit Details from the context menu

    2) Right click the file you want to look at and select Compare with Previous from the context menu.

    3) View diff window...

    (Don't think you can get diff with two non-consecutive commits.)

    0 讨论(0)
提交回复
热议问题