Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View diff between two git revisions in VS2013

When using git for source control in VS2013, is there any way to show a diff between two arbitrary versions of a source file in the integrated editor (either with built in functionality or a free extension/plugin)?

So far I only found out how to display the changes made since the last commit or from one commit to the next.

If it makes any difference: I'm using VS mostly for c++.

like image 273
MikeMB Avatar asked Apr 26 '15 11:04

MikeMB


3 Answers

While this can be done by comparing two revisions selected in the history window for the file I would recommend the free CodeLineage extension, which include a slider that makes selecting revisions to compare dynamic and really easy. Instead of having to go back to the history window to select another pair to compare, just change the slider to the revisions you are interested in.

It's available in the online Visual Studio Gallery in Extensions and Updates inside VS too.

Sample image showing the slider to change revision at the top of the window and revision time, user and id in each window.

enter image description here

like image 154
jpw Avatar answered Nov 15 '22 10:11

jpw


You can do the following:

  1. Right click on the file and choose "View History"

    enter image description here

  2. On the history tab choose the two revisions you'd like to compare

    enter image description here

  3. Finally click on one of the selected revisions and choose "Compare..."

    enter image description here

like image 20
Amnon Shochot Avatar answered Nov 15 '22 09:11

Amnon Shochot


Also useful perhaps is the ability to compare the file you are currently editing with the most recent committed version. Right click on the file and selecting "Compare with unmodified..." seems to do the trick.

like image 1
ifinlay Avatar answered Nov 15 '22 08:11

ifinlay