One of the commonest requirements in project development is to see what has changed. You might want to look at the differences between two revisions of the same file, or the differences between two separate files. TortoiseGit provides a built-in tool named TortoiseGitMerge for viewing differences of text files. For viewing differences of image files, TortoiseGit also has a tool named TortoiseGitIDiff. Of course, you can use your own favorite diff program if you like.
If you want to see what (uncommitted) changes you have made in your working tree, just use the explorer context menu and select → .
If you want to see the difference between a particular revision and your working tree, use the Log dialog, select the revision of interest, then select the section called “Log Dialog”).from the context menu (cf.
If you want to see the difference between the last committed revision and your working tree, assuming that the working tree hasn't been modified, just right click on the file. Then select→ . This will perform a diff between the revision before the last-commit-date (as recorded in your working tree) and the working BASE. This shows you the last change made to that file to bring it to the state you now see in your working tree. It will not show changes newer than your working tree.
If you want to see the difference between two revisions which are already committed, use the Log dialog and select the two revisions you want to compare (using the usual Ctrl-modifier). Then select from the context menu (cf. the section called “Log Dialog”). Then the Compare Revisions dialog appears, showing a list of changed files (maybe with a folder filter pre-applied). Read more in the section called “Comparing Version”.
If you want to see the changes made to all files in a particular revision in one view, you can use Unified-Diff output (GNU patch format). This shows only the differences with a few lines of context. It is harder to read than a visual file compare, but will show all the changes together. From the Revision Log dialog select the revision of interest, then selectfrom the context menu.
If you want to see the differences between two different files, you can do that directly in explorer by selecting both files (using the usual Ctrl-modifier). Then from the explorer context menu select → .
If you want to see the changes of different branches (maybe the current one to another branch or two branches) you can use the log dialog and select the two revisions as described above for "Difference between two previous revisions". An easier way is to open the reference browser (cf. the section called “Browse All Refs”). There you can click on one branch and select to see all changes between that branch and your current state of the working tree. You can also select two branches and compare those using the context menu as described in the section called “Browse All Refs”.
The built-in tools supplied with TortoiseGit do not support viewing differences between directory hierarchies.
If you have configured a third party diff tool, you can use Shift when selecting the Diff command to use the alternate tool resp. the build in tool. Read the section called “External Program Settings” to find out about configuring other diff tools.
Sometimes in the life of a project you might change the line endings from
LF, or you may change the indentation of a section. Unfortunately this will mark a large number of lines as changed, even though there is no change to the meaning of the code. The options here will help to manage these changes when it comes to comparing and applying differences. You will see these settings in the Comparing Version dialog (cf. the section called “Comparing Version”), as well as in the settings for TortoiseGitMerge.
Ignore line endings excludes changes which are due solely to difference in line-end style.
Compare whitespaces includes all changes in indentation and inline whitespace as added/removed lines.
Ignore whitespace changes excludes changes which are due solely to a change in the amount or type of whitespace, e.g. changing the indentation or changing tabs to spaces. Adding whitespace where there was none before, or removing a whitespace completely is still shown as a change.
Ignore all whitespaces excludes all whitespace-only changes.
Naturally, any line with changed content is always included in the diff.
In log dialog, when you select two commits → , or when you select a commit → ; or in Windows Explorer, when you select no files or a folder → , the Compare Revisions Dialog comes up.
This dialog shows a list of all files which have changed and allows you to compare them individually using context menu.
You can Revert selected files to version 1 or version 2. There are 2 menu items for this purpose.→ where xxxxxxx is revision 1 short hash and yyyyyyy revision is 2 short hash.
You can export a change tree, which is useful if you need to send someone else your project tree structure, but containing only the files which have changed. This operation works on the selected files only, so you need to select the files of interest - usually that means all of them - and then → . You will be prompted for a location to save the change tree.
You can also export the list of changed files to a text file using → .
If you want to export the list of files and the actions (modified, added, deleted) as well, you can do that using → .
The button at the top allows you to change the direction of comparison. You can show the changes need to get from A to B, or if you prefer, from B to A.
The buttons with the revision numbers on can be used to change to a different revision range. When you change the range, the list of items which differ between the two revisions will be updated automatically.
If the list of filenames is very long, you can use the search box to reduce the list to filenames containing specific text. Note that a simple text search is used, so if you want to restrict the list to C source files you should enter
.c rather than
*.c. The search syntax is similar to the one available in the Log dialog (cf. the section called “Filtering Log Messages”).
The built-in diff command of git is available for diffing submodules, but we often find ourselves wanting to see more details how a submodule has changed too. That's why we created Submodule Diff Dialog. The Submodule Diff Dialog is only accessible using the the section called “Committing Your Changes To The Repository” or the section called “Getting Status Information” dialogs using the entry in the context menu for a submodule.
The 'From' group box on the top displays the information of the original revision. Below it, there is a 'To' group box, which display the information of the changed revision. For each group box, the full commit hash is displayed, and can be highlighted and copied to clipboard; the subject (i.e. first line of commit message) is displayed and also copyable to clipboard; the Show Log button brings you to a new Log Dialog and jump to that revision.
To better draw the attention of the change of revision of submodule mounted, we added some indicators. In 'To' group box, there is a change type field. Here list out the types:
Topology-based. This is for a fast-forward change.
Topology-based. This is the reversed direction of a fast-forward change.
Time-based. If it is neither fast-forward nor rewind, then we compare commit time. This is for a revision with newer commit time than the original revision.
Time-based. This is the reversal of 'Newer commit time'.
Time-based. The commit time is the same. This may be produced by auto-generating commits or committing at the same time by two persons.
This is for newly added submodule.
This is for deleted submodule.
This is for submodule revision hash not changed, error, etc..
If current workspace of the submodule is dirty, the commit hash will be rendered in yellow background and red text.
In both group boxes, if the revision is not fetched, submodule not initialized or other errors, the commit hash will be rendered in red background.
There are many tools available for diffing text files, including our own TortoiseGitMerge, but we often find ourselves wanting to see how an image file has changed too. That's why we created TortoiseGitIDiff.
→ for any of the common image file formats will start TortoiseGitIDiff to show image differences. By default the images are displayed side-by-side but you can use the View menu or toolbar to switch to a top-bottom view instead, or if you prefer, you can overlay the images and pretend you are using a lightbox.
Naturally you can also zoom in and out and pan around the image. You can also pan the image simply by left-dragging it. If you select the Link images together option, then the pan controls (scrollbars, mousewheel) on both images are linked.
An image info box shows details about the image file, such as the size in pixels, resolution and color depth. If this box gets in the way, use→ to hide it. You can get the same information in a tooltip if you hover the mouse over the image title bar.
When the images are overlaid, the relative intensity of the images (alpha blend) is controlled by a slider control at the left side. You can click anywhere in the slider to set the blend directly, or you can drag the slider to change the blend interactively. Ctrl+Shift-Wheel to change the blend.
The button above the slider toggles between two preset blends, indicated by the markers on either side of the blend slider. By default one is at the top and the other at the bottom, so the toggle button just switches between one image and the other. You can move the markers to choose the two blend values that the toggle button will use.
Sometimes you want to see a difference rather than a blend. You might have the image files for two revisions of a printed circuit board and want to see which tracks have changed. If you disable alpha blend mode, the difference will be shown as an XOR of the pixel color values. Unchanged areas will be plain white and changes will be colored.
If the tools we provide don't do what you need, try one of the many open-source or commercial programs available. Everyone has their own favorites, and this list is by no means complete, but here are a few that you might consider:
WinMerge is a great open-source diff tool which can also handle directories.
Perforce is a commercial RCS, but you can download the diff/merge tool for free. Get more information from Perforce .
KDiff3 is a free diff tool which can also handle directories. You can download it from here .
ExamDiff Standard is freeware. It can handle files but not directories. ExamDiff Pro is shareware and adds a number of goodies including directory diff and editing capability. In both flavours, version 3.2 and above can handle unicode. You can download them from PrestoSoft .
Similar to ExamDiff Pro, this is an excellent shareware diff tool which can handle directory diffs and unicode. Download it from Scooter Software .
Araxis Merge is a useful commercial tool for diff and merging both files and folders. It does three-way comparison in merges and has synchronization links to use if you've changed the order of functions. Download it from Araxis .
This text editor includes syntax coloring for unified diffs, making them much easier to read. Download it from Scintilla .
Notepad2 is designed as a replacement for the standard Windows Notepad program, and is based on the Scintilla open-source edit control. As well as being good for viewing unified diffs, it is much better than the Windows notepad for most jobs. Download it for free here .
Notepad2 is included in the TortoiseGit Setup as an alternative editor which support LF only line endings. An entry in the start menu named Notepad2 is created.
Read the section called “External Program Settings” for information on how to set up TortoiseGit to use these tools.