OSDN Git Service

Update a little help document
[tortoisegit/TortoiseGitJp.git] / doc / source / en / TortoiseSVN / tsvn_dug / dug_diff.xml
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE sect1 SYSTEM "../../../dtd/dblite.dtd">\r
3 <sect1 id="tsvn-dug-diff">\r
4         <title>Viewing Differences</title>\r
5         <indexterm>\r
6                 <primary>diff</primary>\r
7         </indexterm>\r
8         <indexterm>\r
9                 <primary>compare</primary>\r
10         </indexterm>\r
11         <para>\r
12                 One of the commonest requirements in project development is to\r
13                 see what has changed. You might want to look at the differences\r
14                 between two revisions of the same file, or the differences between\r
15                 two separate files.\r
16                 TortoiseGit provides a built-in tool named \r
17                 <application>TortoiseMerge</application> for viewing differences of\r
18                 text files. For viewing differences of image files, TortoiseGit\r
19                 also has a tool named <application>TortoiseIDiff</application>.\r
20                 Of course, you can use your own favourite diff program if you\r
21                 like.\r
22         </para>\r
23         <sect2 id="tsvn-dug-diff-file">\r
24                 <?dbhh topicname="HIDD_URLDIFF"?>\r
25                 <title>File Differences</title>\r
26                 <variablelist>\r
27                         <varlistentry>\r
28                                 <term>Local changes</term>\r
29                                 <listitem>\r
30                                         <para>\r
31                                                 If you want to see what changes <emphasis>you</emphasis>\r
32                                                 have made in your working copy, just use the explorer\r
33                                                 context menu and select\r
34                                                 <menuchoice>\r
35                                                         <guimenu>TortoiseGit</guimenu>\r
36                                                         <guimenuitem>Diff</guimenuitem>\r
37                                                 </menuchoice>.\r
38                                         </para>\r
39                                 </listitem>\r
40                         </varlistentry>\r
41                         <varlistentry>\r
42                                 <term>Difference to another branch/tag</term>\r
43                                 <listitem>\r
44                                         <para>\r
45                                                 If you want to see what has changed on trunk (if you are\r
46                                                 working on a branch) or on a specific branch (if you are\r
47                                                 working on trunk), you can use the explorer context menu.\r
48                                                 Just hold down the <keycap>Shift</keycap> key while you\r
49                                                 right click on the file. Then select\r
50                                                 <menuchoice>\r
51                                                         <guimenu>TortoiseGit</guimenu>\r
52                                                         <guimenuitem>Diff with URL</guimenuitem>\r
53                                                 </menuchoice>. In the following dialog, specify the URL in\r
54                                                 the repository with which you want to compare your local\r
55                                                 file to.\r
56                                         </para>\r
57                                         <para>\r
58                                                 You can also use the repository browser and select two\r
59                                                 trees to diff, perhaps two tags, or a branch/tag and trunk.\r
60                                                 The context menu there allows you to compare them\r
61                                                 using <guimenuitem>Compare revisions</guimenuitem>.\r
62                                                 Read more in <xref linkend="tsvn-dug-compare-revs"/>.\r
63                                         </para>\r
64                                 </listitem>\r
65                         </varlistentry>\r
66                         <varlistentry>\r
67                                 <term>Difference from a previous revision</term>\r
68                                 <listitem>\r
69                                         <para>\r
70                                                 If you want to see the difference between a particular\r
71                                                 revision and your working copy, use the Revision Log\r
72                                                 dialog, select the revision of interest, then select\r
73                                                 <guimenuitem>Compare with working copy</guimenuitem>\r
74                                                 from the context menu.\r
75                                         </para>\r
76                                         <para>\r
77                                                 If you want to see the difference between the last committed\r
78                                                 revision and your working copy, assuming that the working copy\r
79                                                 hasn't been modified, just right click on the file. Then select\r
80                                                 <menuchoice>\r
81                                                         <guimenu>TortoiseGit</guimenu>\r
82                                                         <guimenuitem>Diff with previous version</guimenuitem>\r
83                                                 </menuchoice>.\r
84                                                 This will perform a diff between the revision before\r
85                                                 the last-commit-date (as recorded in your working copy) and the\r
86                                                 working BASE. This shows you the last change made to that file\r
87                                                 to bring it to the state you now see in your working copy.\r
88                                                 It will not show changes newer than your working copy.\r
89                                         </para>\r
90                                 </listitem>\r
91                         </varlistentry>\r
92                         <varlistentry>\r
93                                 <term>Difference between two previous revisions</term>\r
94                                 <listitem>\r
95                                         <para>\r
96                                                 If you want to see the difference between two revisions\r
97                                                 which are already committed, use the Revision Log\r
98                                                 dialog and select the two revisions you want to compare\r
99                                                 (using the usual <keycap>Ctrl</keycap>-modifier).\r
100                                                 Then select <guimenuitem>Compare revisions</guimenuitem>\r
101                                                 from the context menu.\r
102                                         </para>\r
103                                         <para>\r
104                                                 If you did this from the revision log for a folder,\r
105                                                 a Compare Revisions dialog appears, showing a list\r
106                                                 of changed files in that folder. Read more in\r
107                                                 <xref linkend="tsvn-dug-compare-revs"/>.\r
108                                         </para>\r
109                                 </listitem>\r
110                         </varlistentry>\r
111                         <varlistentry>\r
112                                 <term>All changes made in a commit</term>\r
113                                 <listitem>\r
114                                         <para>\r
115                                                 If you want to see the changes made to all files\r
116                                                 in a particular revision in one view, you can\r
117                                                 use Unified-Diff output (GNU patch format). This shows\r
118                                                 only the differences with a few lines of context. It\r
119                                                 is harder to read than a visual file compare, but will\r
120                                                 show all the changes together. From the Revision Log\r
121                                                 dialog select the revision of interest, then select\r
122                                                 <guimenuitem>Show Differences as Unified-Diff</guimenuitem>\r
123                                                 from the context menu.\r
124                                         </para>\r
125                                 </listitem>\r
126                         </varlistentry>\r
127                         <varlistentry>\r
128                                 <term>Difference between files</term>\r
129                                 <listitem>\r
130                                         <para>\r
131                                                 If you want to see the differences between two different\r
132                                                 files, you can do that directly in explorer by selecting\r
133                                                 both files (using the usual <keycap>Ctrl</keycap>-modifier).\r
134                                                 Then from the explorer context menu select\r
135                                                 <menuchoice>\r
136                                                         <guimenu>TortoiseGit</guimenu>\r
137                                                         <guimenuitem>Diff</guimenuitem>\r
138                                                 </menuchoice>.\r
139                                         </para>\r
140                                 </listitem>\r
141                         </varlistentry>\r
142                         <varlistentry>\r
143                                 <term>Difference between WC file/folder and a URL</term>\r
144                                 <listitem>\r
145                                         <para>\r
146                                                 If you want to see the differences between a file in your\r
147                                                 working copy, and a file in any Subversion repository,\r
148                                                 you can do that directly in explorer by selecting the\r
149                                                 file then holding down the <keycap>Shift</keycap> key whilst\r
150                                                 right clicking to obtain the context menu. Select\r
151                                                 <menuchoice>\r
152                                                         <guimenu>TortoiseGit</guimenu>\r
153                                                         <guimenuitem>Diff with URL</guimenuitem>\r
154                                                 </menuchoice>.\r
155                                                 You can do the same thing for a working copy folder.\r
156                                                 TortoiseMerge shows these differences in the same way\r
157                                                 as it shows a patch file - a list of changed files which\r
158                                                 you can view one at a time.\r
159                                         </para>\r
160                                 </listitem>\r
161                         </varlistentry>\r
162                         <varlistentry>\r
163                                 <term>Difference with blame information</term>\r
164                                 <listitem>\r
165                                         <para>\r
166                                                 If you want to see not only the differences but also the author,\r
167                                                 revision and date that changes were made, you can combine the\r
168                                                 diff and blame reports from within the revision log dialog.\r
169                                                 Read <xref linkend="tsvn-dug-blame-diffs"/> for more detail.\r
170                                         </para>\r
171                                 </listitem>\r
172                         </varlistentry>\r
173                         <varlistentry>\r
174                                 <term>Difference between folders</term>\r
175                                 <listitem>\r
176                                         <para>\r
177                                                 The built-in tools supplied with TortoiseGit do not support\r
178                                                 viewing differences between directory hierarchies. But if you\r
179                                                 have an external tool which does support that feature, you can\r
180                                                 use that instead. In <xref linkend="tsvn-dug-diff-tools"/>\r
181                                                 we tell you about some tools which we have used.\r
182                                         </para>\r
183                                 </listitem>\r
184                         </varlistentry>\r
185                 </variablelist>\r
186                 <para>\r
187                         If you have configured a third party diff tool, you can use\r
188                         <keycap>Shift</keycap> when selecting the Diff command to\r
189                         use the alternate tool.\r
190                         Read <xref linkend="tsvn-dug-settings-progs"/> to\r
191                         find out about configuring other diff tools.\r
192                 </para>\r
193         </sect2>\r
194         <sect2 id="tsvn-dug-diff-eol-whitespace">\r
195                 <title>Line-end and Whitespace Options</title>\r
196                 <para>\r
197                         Sometimes in the life of a project you might change the line endings\r
198                         from <literal>CRLF</literal> to <literal>LF</literal>, or you may\r
199                         change the indentation of a section. Unfortunately this will mark\r
200                         a large number of lines as changed, even though there is no change\r
201                         to the meaning of the code. The options here will help to manage\r
202                         these changes when it comes to comparing and applying differences.\r
203                         You will see these settings in the <guilabel>Merge</guilabel> and\r
204                         <guilabel>Blame</guilabel> dialogs, as well as in the settings for\r
205                         TortoiseMerge.\r
206                 </para>\r
207                 <para>\r
208                         <guilabel>Ignore line endings</guilabel>\r
209                         excludes changes which are due solely to difference in line-end style.\r
210                 </para>\r
211                 <para>\r
212                         <guilabel>Compare whitespaces</guilabel>\r
213                         includes all changes in indentation and inline whitespace as\r
214                         added/removed lines.\r
215                 </para>\r
216                 <para>\r
217                         <guilabel>Ignore whitespace changes</guilabel>\r
218                         excludes changes which are due solely to a change in the\r
219                         amount or type of whitespace, eg. changing the indentation\r
220                         or changing tabs to spaces. Adding whitespace where there\r
221                         was none before, or removing a whitespace completely is still\r
222                         shown as a change.\r
223                 </para>\r
224                 <para>\r
225                         <guilabel>Ignore all whitespaces</guilabel>\r
226                         excludes all whitespace-only changes.\r
227                 </para>\r
228                 <para>\r
229                         Naturally, any line with changed content is always included in\r
230                         the diff.\r
231                 </para>\r
232         </sect2>\r
233         <sect2 id="tsvn-dug-compare-revs">\r
234                 <title>Comparing Folders</title>\r
235                 <indexterm>\r
236                         <primary>compare revisions</primary>\r
237                 </indexterm>\r
238                 <indexterm>\r
239                         <primary>export changes</primary>\r
240                 </indexterm>\r
241                 <para>\r
242                         <figure id="tsvn-dug-compare-revs-dia-1">\r
243                                 <title>The Compare Revisions Dialog</title>\r
244                                 <graphic fileref="../images/CompareRevisions.png"/>\r
245                         </figure>\r
246                         When you select two trees within the repository browser, or when\r
247                         you select two revisions of a folder in the log dialog, you can\r
248                         <menuchoice>\r
249                                 <guimenu>Context menu</guimenu>\r
250                                 <guimenuitem>Compare revisions</guimenuitem>\r
251                         </menuchoice>.\r
252                 </para>\r
253                 <para>\r
254                         This dialog shows a list of all files which have changed and allows\r
255                         you to compare or blame them individually using context menu.\r
256                 </para>\r
257                 <para>\r
258                         You can export a <emphasis>change tree</emphasis>, which is useful\r
259                         if you need to send someone else your project tree structure, but\r
260                         containing only the files which have changed.\r
261                         This operation works on the selected files only, so you need\r
262                         to select the files of interest - usually that means all of them -\r
263                         and then\r
264                         <menuchoice>\r
265                                 <guimenu>Context menu</guimenu>\r
266                                 <guimenuitem>Export selection to...</guimenuitem>\r
267                         </menuchoice>.\r
268                         You will be prompted for a location to save the change tree.\r
269                 </para>\r
270                 <para>\r
271                         You can also export the <emphasis>list</emphasis> of changed files\r
272                         to a text file using\r
273                         <menuchoice>\r
274                                 <guimenu>Context menu</guimenu>\r
275                                 <guimenuitem>Save list of selected files to...</guimenuitem>\r
276                         </menuchoice>.\r
277                 </para>\r
278                 <para>\r
279                         If you want to export the list of files <emphasis>and</emphasis>\r
280                         the actions (modified, added, deleted) as well, you can do that using\r
281                         <menuchoice>\r
282                                 <guimenu>Context menu</guimenu>\r
283                                 <guimenuitem>Copy selection to clipboard</guimenuitem>\r
284                         </menuchoice>.\r
285                 </para>\r
286                 <para>\r
287                         The button at the top allows you to change the direction of\r
288                         comparison. You can show the changes need to get from A to B,\r
289                         or if you prefer, from B to A.\r
290                 </para>\r
291                 <para>\r
292                         The buttons with the revision numbers on can be used to change to a\r
293                         different revision range. When you change the range, the list of items\r
294                         which differ between the two revisions will be updated automatically.\r
295                 </para>\r
296                 <para>\r
297                         If the list of filenames is very long, you can use the search box\r
298                         to reduce the list to filenames containing specific text. Note that\r
299                         a simple text search is used, so if you want to restrict the list\r
300                         to C source files you should enter <filename>.c</filename> rather than\r
301                         <filename>*.c</filename>.\r
302                 </para>\r
303         </sect2>\r
304         <sect2 id="tsvn-dug-idiff">\r
305                 <title>Diffing Images Using TortoiseIDiff</title>\r
306                 <indexterm>\r
307                         <primary>image diff</primary>\r
308                 </indexterm>\r
309                 <indexterm>\r
310                         <primary>TortoiseIDiff</primary>\r
311                 </indexterm>\r
312                 <para>\r
313                         There are many tools available for diffing text files, including our\r
314                         own TortoiseMerge, but we often find ourselves wanting to see how\r
315                         an image file has changed too. That's why we created TortoiseIDiff.\r
316                 </para>\r
317                 <para>\r
318                         <figure id="tsvn-dug-idiff-dia-1">\r
319                                 <title>The image difference viewer</title>\r
320                                 <graphic fileref="../images/TortoiseIDiff.png"/>\r
321                         </figure>\r
322                         <menuchoice>\r
323                                 <guimenu>TortoiseGit</guimenu>\r
324                                 <guimenuitem>Diff</guimenuitem>\r
325                         </menuchoice>\r
326                         for any of the common image file formats will start TortoiseIDiff\r
327                         to show image differences. By default the images are displayed side-by-side\r
328                         but you can use the View menu or toolbar to switch to a top-bottom\r
329                         view instead, or if you prefer, you can overlay the images and pretend\r
330                         you are using a lightbox.\r
331                 </para>\r
332                 <para>\r
333                         Naturally you can also zoom in and out and pan around the image.\r
334                         You can also pan the image simply by left-dragging it.\r
335                         If you select the <guilabel>Link images together</guilabel> option,\r
336                         then the pan controls (scrollbars, mousewheel) on both images are linked.\r
337                 </para>\r
338                 <para>\r
339                         An image info box shows details about the image file, such as the\r
340                         size in pixels, resolution and colour depth. If this box gets in the\r
341                         way, use\r
342                         <menuchoice>\r
343                                 <guimenu>View</guimenu>\r
344                                 <guimenuitem>Image Info</guimenuitem>\r
345                         </menuchoice>\r
346                         to hide it.\r
347                         You can get the same information in a tooltip if you hover the mouse\r
348                         over the image title bar.\r
349                 </para>\r
350                 <para>\r
351                         When the images are overlaid, the relative intensity of the images\r
352                         (alpha blend) is controlled by a slider control at the left side.\r
353                         You can click anywhere in the slider to set the blend directly, or you\r
354                         can drag the slider to change the blend interactively.\r
355                         <keycap>Ctrl+Shift</keycap>-<action>Wheel</action> to change the blend.\r
356                 </para>\r
357                 <para>\r
358                         The button above the slider toggles between two preset blends, indicated\r
359                         by the markers on either side of the blend slider. By default one is at\r
360                         the top and the other at the bottom, so the toggle button just switches\r
361                         between one image and the other. You can move the markers to choose\r
362                         the two blend values that the toggle button will use.\r
363                 </para>\r
364                 <para>\r
365                         Sometimes you want to see a difference rather than a blend. You might\r
366                         have the image files for two revisions of a printed circuit board and\r
367                         want to see which tracks have changed. If you disable alpha blend mode,\r
368                         the difference will be shown as an <emphasis>XOR</emphasis> of the pixel\r
369                         colour values. Unchanged areas will be plain white and changes will be\r
370                         coloured.\r
371                 </para>\r
372         </sect2>\r
373         <sect2 id="tsvn-dug-diff-tools">\r
374                 <title>External Diff/Merge Tools</title>\r
375                 <indexterm>\r
376                         <primary>diff tools</primary>\r
377                 </indexterm>\r
378                 <indexterm>\r
379                         <primary>merge tools</primary>\r
380                 </indexterm>\r
381                 <para>\r
382                         If the tools we provide don't do what you need, try one of the many\r
383                         open-source or commercial programs available. Everyone has their own\r
384                         favourites, and this list is by no means complete, but here are a few\r
385                         that you might consider:\r
386                 </para>\r
387                 <variablelist>\r
388                         <varlistentry>\r
389                                 <term>WinMerge</term>\r
390                                 <listitem>\r
391                                         <para>\r
392                                                 <ulink url="http://winmerge.sourceforge.net/">\r
393                                                         <citetitle>WinMerge</citetitle>\r
394                                                 </ulink>\r
395                                                 is a great open-source diff tool which can also\r
396                                                 handle directories.\r
397                                         </para>\r
398                                 </listitem>\r
399                         </varlistentry>\r
400                         <varlistentry>\r
401                                 <term>Perforce Merge</term>\r
402                                 <listitem>\r
403                                         <para>\r
404                                                 Perforce is a commercial RCS, but you can download the\r
405                                                 diff/merge tool for free. Get more information from\r
406                                                 <ulink url="http://www.perforce.com/perforce/products/merge.html">\r
407                                                         <citetitle>Perforce</citetitle>\r
408                                                 </ulink>.\r
409                                         </para>\r
410                                 </listitem>\r
411                         </varlistentry>\r
412                         <varlistentry>\r
413                                 <term>KDiff3</term>\r
414                                 <listitem>\r
415                                         <para>\r
416                                                 KDiff3 is a free diff tool which can also handle\r
417                                                 directories. You can download it from\r
418                                                 <ulink url="http://kdiff3.sf.net/">\r
419                                                         <citetitle>here</citetitle>\r
420                                                 </ulink>.\r
421                                         </para>\r
422                                 </listitem>\r
423                         </varlistentry>\r
424                         <varlistentry>\r
425                                 <term>ExamDiff</term>\r
426                                 <listitem>\r
427                                         <para>\r
428                                                 ExamDiff Standard is freeware. It can handle\r
429                                                 files but not directories.\r
430                                                 ExamDiff Pro is shareware and adds a number\r
431                                                 of goodies including directory diff and editing\r
432                                                 capability.\r
433                                                 In both flavours, version 3.2 and above can handle\r
434                                                 unicode. You can download them from\r
435                                                 <ulink url="http://www.prestosoft.com/">\r
436                                                         <citetitle>PrestoSoft</citetitle>\r
437                                                 </ulink>.\r
438                                         </para>\r
439                                 </listitem>\r
440                         </varlistentry>\r
441                         <varlistentry>\r
442                                 <term>Beyond Compare</term>\r
443                                 <listitem>\r
444                                         <para>\r
445                                                 Similar to ExamDiff Pro, this is an excellent shareware\r
446                                                 diff tool which can handle directory diffs and unicode.\r
447                                                 Download it from\r
448                                                 <ulink url="http://www.scootersoftware.com/">\r
449                                                         <citetitle>Scooter Software</citetitle>\r
450                                                 </ulink>.\r
451                                         </para>\r
452                                 </listitem>\r
453                         </varlistentry>\r
454                         <varlistentry>\r
455                                 <term>Araxis Merge</term>\r
456                                 <listitem>\r
457                                         <para>\r
458                                                 Araxis Merge is a useful commercial tool for diff and merging\r
459                                                 both files and folders. It does three-way comparison in merges\r
460                                                 and has synchronization links to use if you've changed the order\r
461                                                 of functions. Download it from\r
462                                                 <ulink url="http://www.araxis.com/merge/index.html">\r
463                                                         <citetitle>Araxis</citetitle>\r
464                                                 </ulink>.\r
465                                         </para>\r
466                                 </listitem>\r
467                         </varlistentry>\r
468                         <varlistentry>\r
469                                 <term>SciTE</term>\r
470                                 <listitem>\r
471                                         <para>\r
472                                                 This text editor includes syntax colouring for unified diffs,\r
473                                                 making them much easier to read. Download it from\r
474                                                 <ulink url="http://www.scintilla.org/SciTEDownload.html">\r
475                                                         <citetitle>Scintilla</citetitle>\r
476                                                 </ulink>.\r
477                                         </para>\r
478                                 </listitem>\r
479                         </varlistentry>\r
480                         <varlistentry>\r
481                                 <term>Notepad2</term>\r
482                                 <listitem>\r
483                                         <para>\r
484                                                 Notepad2 is designed as a replacement for the standard\r
485                                                 Windows Notepad program, and is based on the Scintilla\r
486                                                 open-source edit control. As well as being good for\r
487                                                 viewing unified diffs, it is much better than the\r
488                                                 Windows notepad for most jobs. Download it for free\r
489                                                 <ulink url="http://www.flos-freeware.ch/notepad2.html">\r
490                                                         <citetitle>here</citetitle>\r
491                                                 </ulink>.\r
492                                         </para>\r
493                                 </listitem>\r
494                         </varlistentry>\r
495                 </variablelist>\r
496                 <para>\r
497                         Read <xref linkend="tsvn-dug-settings-progs"/> for information\r
498                         on how to set up TortoiseGit to use these tools.\r
499                 </para>\r
500         </sect2>\r
501 </sect1>\r