tortoisegittortoisemerge

How to compare two files in two revisions with TortoiseGit?


I've moved a function from one file to another, and I'd like to compare the moved version to the original, so I'd like a diff with the source file on the left and the destination file on the right. Using TortoiseGit I can figure out how to diff two files in the working tree, or diff one file across multiple commits, but not both at once. Is it possible without checking out the two files?


Solution

  • There is a way to do this (but not an obvious direct one):

    Open the log dialog and navigate to the commit/file you want to diff. Drop it into Explorer or select "Save revision to..." and then select the two files you want to compare and select TortoiseGit -> Diff.

    If the file is modified or was already committed in the meantime then you can also open the log dialog (make sure so that both files are in the history, e.g., by opening the log on a common directory). Select the commit of the first file and click on "Mark for comparison" in the context menu of the file, then navigate to the commit of the second file and select "Diff with ...".

    UPDATE:

    Starting with TortoiseGit 2.10.1.0 (preview release) you can select a file in Explorer and mark it using TortoiseGit -> "Diff later" and compare a file to this file from Log Dialog or Repository Browser using "Diff with ..." as described above.