- "Diff" redirects here. For the Wikimedia community blog, see Diff (blog).
A diff is the difference between two versions of a page. It can be viewed from the page history. For every version there are potentially two radio buttons: the left column is for selecting the older version, the right column for selecting the newer one. Pressing "Compare selected versions" gives the difference between the two versions.
For special cases (the diff for a single edit or between an old and the current version) other possibilities are clicking cur or last in the page history or on the Recent Changes page. The diff is also shown during an edit conflict so you can see exactly what you need to reintegrate.
From MediaWiki 1.5 diff works also in preview, showing the difference between the currently stored version and the current version in the edit box.
How it looksEdit
This example shows the top of the diff page (some of the links are dummies).
(copy edit, +MediaWiki User's Guide) Line 3: Line 3: For sysops, a [[en:Wikipedia:revert|rollback]] button is shown allowing them to revert from the new version to the old one. For sysops, a [[en:Wikipedia:revert|rollback]] button is shown allowing them to revert from the new version to the old one. − This is only shown when viewing the diff between the current version and the one immediately preceding it. + 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. This example shows the top of the diff page, with links the described above. This example shows the top of the diff page, with links the described above. + + == See also == + * [[Help:Contents|MediaWiki User's Guide]]
The two versions are shown side-by-side. In left-to-right languages, the old version is on the left. This is reversed in right-to-left scripts. The links "Revision as of date" link to each version (from MediaWiki 1.4). If the newer version is the latest one, the link will be to the usual page and the wording will be "Current revision (date)" instead.
The (edit) link will take you to the page for editing that version. You may be warned that you are editing an out-of-date revision, and if you ignore it and continue, you will revert all the edits done after that revision.
The (undo) link on the newer revision's side will revert that specific edit. When you click the link you can check the diff page of the edit you are going to make, and the edit summary will be automatically filled in with the phrase of MediaWiki:undo-summary (Undo revision $1 by $2 (talk)). This summary can be edited before you submit your edit. When you are undoing several edits at once, the auto-summary may not work. Though the link exists on all diff pages, it does not function when the revisions conflict. Often versions older than the current one can not be undone in this way. If it does not work, you will be told that the edit could not be undone and end up in the regular editing page of the current version.
Below that are links to the user page and talk page of the each user who edited the older or the newer versions. Links to the users' contribution lists are also shown. For sysops, a rollback button is also shown if the newer version is the current one, allowing them to revert all of the edits done by that user. Note however that if there is a newer edit done by another user before you sysop uses the rollback, the rollback would not undo the change that is displayed.
Then the edit summaries are shown in a parenthesis. If the user has used links in their edit summary, these act as links on the diff page as well. If the editor marked the edit as an minor edit, m appears before the summary.
Previous diff and Next diff links make it possible to check earlier or later versions. When you are checking the differences between two versions in apart, you will be told that "(x intermediate revisions not shown.)".
On the old version side, paragraphs which differ from the new version are highlighted with yellow, and on the new version with green. Text removed within a paragraph is shown in red on the old version. New text within a paragraph is shown in red on the new version. If a whole paragraph was removed or added, the text is not red but just black, while the other side is blank (white). Unchanged text is black on grey, only parts before and after changed text is shown.
After the table of differences, the latest of the two compared versions is shown fully, unless one specifies in the preferences that this is not done.
Any two versions, even of two different pages, can be compared.
A diff link in internal link style is made with Special:Diff. One of the advantages compared with external link style is that it works in edit summaries. Examples:
- Special:Diff/12345 or Special:Diff/12345/prev (diff of a revision with the previous one)
- Special:Diff/12345/next (diff of a revision with the next one)
- Special:Diff/12345/cur (diff of a revision with the latest one of that page)
- Special:Diff/12345/98765 (diff between arbitrary two revisions)
- en:Special:Diff/12345/98765 (interwiki link)
The id (the number, in the example 12345) is in the url of the version concerned linked from the time and date in the revision history.
In external link style we have for example https://meta.wikimedia.org/w/index.php?oldid=12345&diff=98765.
An administrator can see deleted versions, but directly apply a diff to a single edit only; the url is of a different style, because deleted versions are identified by date and time, not by id. To view other diffs, the pages to be compared have to be (temporarily) restored.
A diff is also used to render a redirect page as an ordinary page, showing also content after the redirect itself. The alternative is using preview.
When moving or copying a piece of text within a page or from another page, and also making other edits, it is useful to separate these edits. This way the diff function can be usefully applied for checking these other edits.
The diff shows differences per line. Some editors find that adding manual line breaks improves the diff function.
If searching the edit summaries does not help, to search for the edit between two revisions in which a particular change from some text A to text B was made (to find the user, the edit summary, and the context is which the change was made), take the diff between 1/3 and 2/3 of the "search space". From the diff and/or the "2/3" version one can conclude in which of the three parts the change was made (if there is A at 2/3, the change was made later; if there is B at 1/3 the change was made before; if the diff shows the change it was made between 1/3 and 2/3). This process can be repeated, every time reducing the search space by a factor 3. For changes in the wikitext which do not affect the rendered page, such as substitution of a template or editing HTML comments, take the diff between 1/2 and the end of the "search space" (if the diff shows the change it was made between 1/2 and the end, otherwise between the start and 1/2). If the change from A to B was made in steps (one finds a time interval where part of the change was made) one can continue the search for that part or the other part, or do the rest of the search for each of the two parts of the change.
One can either search for a deleted phrase or for an added phrase. It is easiest to use a search phrase that applies both for wikitext and for rendered text. For example, to search for the addition of the piped link [[p|q]], search for q.
Copying the search phrase to your clipboard is on most browsers accomplished by highlighting the text and choosing "copy" from edit menu options, or clicking control+c. Searching is done by opening your browser's find option ("find" or control+f), pasting the text saved to your clipboard ("paste" or control+v), and searching for it.
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 display may be wider than the screen, because there are two columns, but also because URLs (especially long ones) are not hidden. In such cases, you must then use the horizontal scrollbar of the browser to see all the display.
To view only the diff without the page content, add &diffonly=1 to the URL, or select "Do not show page content below diffs" in the miscellaneous section of your preferences.
Links to other help pages
- Help contents
- Meta · Wikinews · Wikipedia · Wikiquote · Wiktionary · Commons: · Wikidata · MediaWiki · Wikibooks · Wikisource · MediaWiki: Manual · Google
- Versions of this help page (for other languages see further)
- What links here on Meta
- Go · Search · Stop words · Namespace · Page name · Section · Backlinks · Redirect · Category · Image page · Special pages · Printable version
- Tracking changes
- Recent changes (enhanced) | Related changes · Watching pages · Diff · Page history · Edit summary · User contributions · Minor edit · Patrolled edit
- Logging in and preferences
- Logging in · Preferences · User style
- Starting a new page · Advanced editing · Editing FAQ · Edit toolbar · Export · Import · Shortcuts · Edit conflict · Page size
- Links · URL · Piped links · Interwiki linking · Footnotes
- Style and formatting
- Wikitext examples · CSS · Reference card · HTML in wikitext · Formula · List · Table · Sorting · Colors · Images and file uploads
- Fixing mistakes
- Show preview · Testing · Reverting edits
- Advanced functioning
- Expansion · Template · Advanced templates · Parser function · Parameter default · Variable · System message · Substitution · Array · Calculation · Transclusion
- Special characters · Renaming (moving) a page · Preparing a page for translation · Talk page · Signatures · Sandbox · Legal issues for editors