Help:Diff

{{Short description|Wikipedia help page for diff feature}}

{{pp-move-indef}}

{{pp-semi|small=yes}}

{{selfref|For the Wikimedia blog, see {{url|https://diff.wikimedia.org/}}.}}

{{Hatnote|This page documents the full usage of diffs. For a simpler guide to the basics, see Wikipedia:Simple diff and link guide.}}

{{Wikipedia how-to|H:DIFF|WP:DIFF}}

A diff (from the word "difference") is a web page displaying the difference between one version and another of a Wikipedia page. A particular version of a page is called a "revision"; each revision has a date and time of creation which can be seen in the page history. Clicking a "diff" link in a page's history will display the diff of two successive revisions.

Links to diffs are found on various special pages other than page histories, including the User contributions page which every user has, Recent changes, Related changes, and watchlists.

Using the history of a page, it is possible to generate a diff between any two versions – select the left radio button for the older version, the right radio button for the newer version, and click {{Button|text=Compare selected revisions}}.

While editing a page, the {{Button|text=Show changes}} button displays the changes you are about to make. The diff is also shown during an edit conflict.

{{EditOptions|boldsave=no}}

How it looks

This example shows the top of the diff page (some of the links are dummies). The older version is shown on the left, the newer version on the right.

border="0" style="border-spacing:4px; table-layout:fixed; width:98%"
style="height:1px"

| style="width:2%" |

| style="width:48%" |

| style="width:2%" |

| style="width:48%" |

align="center" valign="top"

| colspan="2" |

(Edit summaries in diffs are great)

| colspan="2" |

m (correction, + MediaWiki User's Guide)

 
colspan="2" | Line 8:

| colspan="2" | Line 8:

style="padding:0.33em 0.66em; border-spacing:4px; font-size:1.25em; font-weight:bold; text-align:right" |  

|style="vertical-align:top; padding:0.33em 0.66em; color:#333333; background-color:#F3F3F3; border-color:#E6E6E6; border-style:solid; border-width:1px 1px 1px 4px; border-radius:0.33em; border-spacing:4px; font-size:85%"| For sysops and those with the rollback flag, a rollback button is shown allowing them to revert from the new version to the old one.

|style="padding:0.33em 0.66em; border-spacing:4px; font-size:1.25em; font-weight:bold; text-align:right" |  

|style="vertical-align:top; padding:0.33em 0.66em; color:#333333; background-color:#F3F3F3; border-color:#E6E6E6; border-style:solid; border-width:1px 1px 1px 4px; border-radius:0.33em; border-spacing:4px; font-size:85%"| For sysops and those with the rollback flag, a rollback button is shown allowing them to revert from the new version to the old one.

style="padding:0.33em 0.66em; border-spacing:4px; font-size:1.25em; font-weight:bold; text-align:right" | −

|style="vertical-align:top; padding:0.33em 0.66em; border-color:var(--background-color-content-removed,#fc3); border-style:solid; border-width:1px 1px 1px 4px; border-radius:0.33em; border-spacing:4px; font-size:85%" | This is only shown when viewing the diff between the current version and the one immediately preceding it.

|style="padding:0.33em 0.66em; border-spacing:4px; font-size:1.25em; font-weight:bold; text-align:right" | +

|style="vertical-align:top; padding:0.33em 0.66em; border-color:var(--background-color-content-added,#afb6e9); border-style:solid; border-width:1px 1px 1px 4px; border-radius:0.33em; border-spacing:4px; font-size:85%" | This is only shown when viewing the diff between the recent version of a page and the last version by an author other than the one of the most current version.

style="padding:0.33em 0.66em; border-spacing:4px; font-size:1.25em; font-weight:bold; text-align:right" |  

|style="vertical-align:top; padding:0.33em 0.66em; color:#333333; background-color:#F3F3F3; border-color:#E6E6E6; border-style:solid; border-width:1px 1px 1px 4px; border-radius:0.33em; border-spacing:4px; font-size:85%"|This example shows the top of the diff page, with the links described above.

|style="padding:0.33em 0.66em; border-spacing:4px; font-size:1.25em; font-weight:bold; text-align:right" |  

|style="vertical-align:top; padding:0.33em 0.66em; color:#333333; background-color:#F3F3F3; border-color:#E6E6E6; border-style:solid; border-width:1px 1px 1px 4px; border-radius:0.33em; border-spacing:4px; font-size:85%"|This example shows the top of the diff page, with the links described above.

colspan="2" | Line 25:

| colspan="2" | Line 25:

style="padding:0.33em 0.66em; border-spacing:4px; font-size:1.25em; font-weight:bold; text-align:right" |  

|style="vertical-align:top; padding:0.33em 0.66em; color:#333333; background-color:#F3F3F3; border-color:#E6E6E6; border-style:solid; border-width:1px 1px 1px 4px; border-radius:0.33em; border-spacing:4px; font-size:85%" |

|style="padding:0.33em 0.66em; border-spacing:4px; font-size:1.25em; font-weight:bold; text-align:right" |  

|style="vertical-align:top; padding:0.33em 0.66em; color:#333333; background-color:#F3F3F3; border-color:#E6E6E6; border-style:solid; border-width:1px 1px 1px 4px; border-radius:0.33em; border-spacing:4px; font-size:85%" | colspan="2" |

|style="padding:0.33em 0.66em; border-spacing:4px; font-size:1.25em; font-weight:bold; text-align:right" | +

|style="vertical-align:top; padding:0.33em 0.66em; border-color:var(--background-color-content-added,#afb6e9); border-style:solid; border-width:1px 1px 1px 4px; border-radius:0.33em; border-spacing:4px; font-size:85%" | MediaWiki User's Guidecolspan="2" |

|style="padding:0.33em 0.66em; border-spacing:4px; font-size:1.25em; font-weight:bold; text-align:right" | +

|style="vertical-align:top; padding:0.33em 0.66em; border-color:var(--background-color-content-added,#afb6e9); border-style:solid; border-width:1px 1px 1px 4px; border-radius:0.33em; border-spacing:4px; font-size:85%" |

= Explanation of colours =

Unchanged text is dark grey on light grey (only parts before and after changed text are shown). Paragraphs which have changed are black on white, with an orange border on the old version side and a blue border on the new version side. Inserted and removed text is highlighted with the border color and bolded. Where whole paragraphs have been removed or inserted, no highlighting or bolding is applied and the other side is blank.

Moved lines of wikitext are marked with curved arrows. Clicking on ↪ and ↩ scrolls the view to the corresponding line on the opposite side of the diff.

class="wikitable" style="border-collapse:separate;background-color:white"

|+Colour key

! align="center" width="200" colspan=2|Old version

! align="center" width="200" colspan=2|New version

style="border:none;"|

|align="center" style="color:#333333;background-color:#F3F3F3;border-color:#E6E6E6;border-style:solid;border-width:1px 1px 1px 4px;border-radius:0.33em;"|unchanged

|style="border:none;"|

|align="center" style="color:#333333;background-color:#F3F3F3;border-color:#E6E6E6;border-style:solid;border-width:1px 1px 1px 4px;border-radius:0.33em;"|unchanged

style="border:none;text-align: right;"|

|align="center" style="border-color:var(--background-color-content-removed,#fc3);border-style:solid;border-width:1px 1px 1px 4px;border-radius:0.33em;"|paragraph changed

|style="border:none;text-align: right;"|+

|align="center" style="border-color:var(--background-color-content-added,#afb6e9);border-style:solid;border-width:1px 1px 1px 4px;border-radius:0.33em;"|paragraph changed

style="border:none;text-align: right;"|{{anchor|moved left side}}#moved right side

|align="center" style="border-color:var(--background-color-content-removed,#fc3);border-style:solid;border-width:1px 1px 1px 4px;border-radius:0.33em;"|paragraph moved

|style="border:none;"|

|align="center" style="border:none"| 

style="border:none;text-align: right;"|

|align="center" style="border-color:var(--background-color-content-removed,#fc3);border-style:solid;border-width:1px 1px 1px 4px;border-radius:0.33em;"|paragraph removed

|style="border:none;"|

|align="center" style="border:none"| 

style="border:none;"|

|align="center" style="border:none"| 

|style="border:none;text-align: right;"|+

|align="center" style="border-color:var(--background-color-content-added,#afb6e9);border-style:solid;border-width:1px 1px 1px 4px;border-radius:0.33em;"|paragraph added

style="border:none;"|

|align="center" style="border:none"| 

|style="border:none;text-align: right;"|{{anchor|moved right side}}#moved left side

|align="center" style="border-color:var(--background-color-content-added,#afb6e9);border-style:solid;border-width:1px 1px 1px 4px;border-radius:0.33em;"|paragraph moved

style="border:none;text-align: right;"|

|align="center" style="border-color:var(--background-color-content-removed,#fc3);border-style:solid;border-width:1px 1px 1px 4px;border-radius:0.33em;"| removed text

|style="border:none;text-align: right;"|+

|align="center" style="border-color:var(--background-color-content-added,#afb6e9);border-style:solid;border-width:1px 1px 1px 4px;border-radius:0.33em;"| added text

Linking to a diff

If you need to create a link to a specific diff (for use on a talk page or noticeboard, for example), it is best to use the Special:Diff/oldid method or {{Tl|Diff}}, which make links work across protocols (http:// vs. https://) and on our mobile site. Alternatively, locate the diff from the page history, go to the diff page, and copy the URL from your browser's address bar. You can paste this URL (the whole of it, including https://) into the text of the page where you want the link to appear, putting single square brackets [...] around it.

= <nowiki>{{Diff}}</nowiki> or <nowiki>{{Diff2}}</nowiki> =

Using {{tl|diff}} or {{T|diff2}} is another approach of linking to a diff within Wikipedia, though it cannot be used in edit summaries. The general syntax is:

:{{tlx|Diff|page|diff|oldid|label}}

  • {{para|page}} – The title of the page.
  • {{para|diff}} – The ID or keyword that is used against the base ID. Possible keywords are:
  • cur – compare with the current (latest) version of a page.
  • prev – compare with the previous version of a page.
  • next – compare with the next version of a page.
  • id – This should be {{em|larger}} than oldid.
  • {{para|oldid}} – The base ID onto which the diff is generated.
  • {{para|label}} – Text to display as link. No label will give a numbered link.
  • {{para|diffonly|yes}} – Shows only a diff and not the page content. Parameter name required.

== <nowiki>{{URL to diff}}</nowiki> ==

{{Tl|URL to diff}} takes a full diff URL and converts it to a {{Tl|Diff}} template. The template should be substituted, thus:

:{{Subst:URL to diff|url=https://en.wikipedia.org/w/index.php?diff=100000001&oldid=123456789|label=relevant text}}

Deleted revisions

A deleted revision is to a version of an article that for some reason has been made "invisible" to the general public. This is occasionally done for reasons like significant copyright violations, disruption, or personal attacks on other Wikipedia contributors.

An administrator can see deleted revisions and related diffs, but those diffs can only be shared with other administrators. In order to allow all users to view the diff, the revisions in question need to be visible to them. It is possible for an administrator to restore a deleted revision if warranted.

See Wikipedia:Revision deletion for further details.

Weave diffs

When moving or copying a piece of text within a page or from another page, and also making other edits in the same revision, the diff can still compare moved paragraphs, even if weave-moved over 20 paragraphs away. Prior to August 2018, a diff could be kept clearer (simpler), by first using a separate edit to insert blank lines plus move the text paragraphs, then after saving, in further revisions, add or change text within the moved paragraphs. Only if paragraphs are both split and reworded in the same revision, then the specific new words cannot be individually highlighted as different from the prior revision. A split paragraph will typically highlight the 2nd part(s) as if new text on the page. The weave-diff can compare paragraphs word-for-word if moved, but not if split.

A diff shows differences per line, so it synchronizes between revisions by matching the newlines and unchanged lines. Some editors find that having additional line breaks to break up the text improves the diff function. Otherwise, those large, massive globs of text can be difficult to compare after a split. Keep sentences limited in length, such as with four prepositions, and seek shorter paragraphs. Long wp:reftag footnotes ({{tag|ref}}) may be split with internal newlines as well.

Searching diffs to spot a particular change

If you're trying to find the point in a page's history where a particular change was made, and searching the edit summaries does not help, try taking the diff between points roughly 1/3 and 2/3 of the way through the history. From this diff, you can work out in which of the three parts of the history the change occurred. Repeat this process, narrowing the "search space" by a factor of three each time, until the precise edit where the change was made is identified. You can also use the external [http://wikipedia.ramselehof.de/wikiblame.php?user_lang=en&lang=en&project=wikipedia WikiBlame] tool, which automates this searching process.

Format for displaying a diff

In the case of the Classic skin with quickbar, the diff page does not have the quickbar, to provide more space. Therefore, the diff page is also useful for viewing the page on full-screen width, without changing the preferences. With the Monobook skin the panels on the left are also on the diff page.

On a diff page, sometimes the whole display might be wider than the screen window, often because some website URLs (especially long ones) are not hidden and do not wrap in a diff column. In such cases, you must then use the horizontal scrollbar of the browser to see the whole width of the display. There is no option to wrap the long lines in the diff display.

Comparing different pages

To view a diff between two separate pages (optionally, at specific revisions), use Special:ComparePages ([https://en.wikipedia.org/wiki/Special:ComparePages?page1=To+the+Moon&rev1=&page2=Finding+Paradise&rev2=&action=&unhide= example]).

Using user scripts

You also can tweak display of your diffs by using various User scripts. See Diffs subsection for more info.

See also

{{Wikipedia glossary}}

{{Help navigation}}

{{Wikipedia technical help|collapsed}}

Diff

de:Hilfe:Versionen#Versionen vergleichen