Wikipedia:How to fix cut and paste moves

In the early days of Wikipedia, renamings took place manually, using cut and paste, before our hard-working developers created the move page function.

Now, cut-and-paste moves are usually done by people who are not aware of that function, or when the move function fails (e.g. because the target has history), and people don't know to use the Cut and paste move repair holding pen to ask for help from an admin.

When a cut-and-paste move is done, the page history of an article or talk page can be split among two or more different pages. This is a Very Bad Thing, because we need to keep the history with the content for copyright reasons.

In some circumstances, administrators are able to fix this by merging page histories, using the procedure given below.

Instructions for tagging a page for history merging

 * 1) Place a   template at the new location of the article which has been moved through cut and pasting, i.e. on the article where the pasting was done.
 * 2) If the issue is clear-cut (straight up cut and paste move to a better title), having the speedy delete tag on the page should be enough. In more complex cases (explained below), please leave a description of the problem at Cut and paste move repair holding pen.

Repair process (for admins)
''Warning: this procedure may only be undone by spending quite silly amounts of time. To undo a merge, see below. Do not do this if you're not sure what you're doing.''

An easy case
The following procedure merges the page histories in the case of a hypothetical example:

Suppose Alabama/History (old title) was the only article on that subject, and that the article developed in the course of a number of edits, until a decision that History of Alabama (new title) was a better style of name for the article. Suppose further that for whatever reason, the contents of the old article were (That is, the move tool was not available or not used, to simultaneously transfer the Wiki text and the history of edits to the new title.) And suppose this replacement (new-title) article develops further and reflects the new history of these further edits. Our goal is to graft the (old) edit history from Alabama/History (article with old title) onto the new history in History of Alabama (article with new title) where those partial histories can complement each other. The admin:
 * cut from the old article,
 * replaced in it with a redirect to the new title, and
 * pasted into a newly created article bearing the new title.
 * 1) Deletes History of Alabama, with comment deleting to merge page histories - back soon.  (Now the new title has no versions in its history.)
 * 2) Moves Alabama/History to History of Alabama, using the move tool. (Now the old versions are the whole of the new title's history.)
 * 3) Undeletes the History of Alabama article, by
 * 4) Viewing the Page history,1
 * 5) Linking via "View or restore ... deleted edits?", and
 * 6) Clicking on "Restore!". (Now the new title's history has both the old and new versions, including an extra copy of the most recent version of Alabama/History, created by the move tool.)
 * 7) At this stage, History of Alabama will only show the text "#redirect History of Alabama" (assuming a redirect was the most recent version of Alabama/History, the History of Alabama page will now be showing whatever the most recent version of Alabama/History was). The last step is to revert to the last version of History of Alabama from before the move, by
 * 8) Linking via "Page history" on History of Alabama.
 * 9) Make a hard reload (Shift+Control+R in Mozilla or Opera and Ctrl + F5 in Internet Explorer), in order to see an up-to-date history reflecting the undeletion.1
 * 10) Selecting, editing (ignoring the warning message about "WARNING: You are editing an out-of-date revision"), and saving the last pre-move version.

A more complex case
Sometimes, after a cut-and-paste move is performed, the article at the old title is then edited for some other purpose (e.g. turning it into a disambiguation page). That causes the article now at NewTitle to have part of its history there, and part at OldTitle, but the history at OldTitle also contains the history of NewMeaning. Use of the selective deletion function allows these to be repaired as well. ''Warning: you will need to click on one check box for each revision. Check the history size and be sure that you're willing to do this work before you start - a page may have tens of thousands of revisions!''

An example of this was Military of Japan; the original was moved to Japan Self-Defense Forces with a cut-and-paste move, and the article Military of Japan was then turned into a disambiguation page. This was repaired with the following procedure:


 * 1) Military of Japan is deleted.
 * 2) Selective undelete is used to undelete only those versions of Military of Japan which belonged to "Japan Self-Defense Forces".
 * 3) Japan Self-Defense Forces is deleted.
 * 4) The versions of "Japan Self-Defense Forces" at Military of Japan are moved to Japan Self-Defense Forces, using the normal page-move function.
 * 5) Undeletion of Japan Self-Defense Forces restores the rest of the versions of that article to its history.1
 * 6) However, the most recent version in the history of Japan Self-Defense Forces is now the most recent version of the old history from Military of Japan (it's a copy of that version, created by the page-move function). So, go into the history of Japan Self-Defense Forces, select the next-most-recent version, click on it, and when it appears, click on "Edit this page", ignore the "WARNING: You are editing an out-of-date revision" message, type something suitable (e.g. "restoring most recent version after merging histories") in the edit summary, and hit "Save page". That article is now restored to its condition prior to this procedure, and now also has its complete history.
 * 7) Step 4 above (the move) will have left a history containing just a redirect at Military of Japan. Delete the redirect.
 * 8) Undeletion of all the other versions of Military of Japan restores the more recent history of that article; no additional steps are needed, as the most recent version should now be the current version.1

A troublesome case
However, the examples just described only work well if the two pieces of the history of one 'article' are disjoint; i.e. one ends before the other begins. These procedures are inadequate if this condition does not apply, e.g. if the copy of the article at the old title has been edited after the pasting of its contents into the new title. For example, it is not uncommon for:
 * 1) an article at (old) page A to be cut and pasted into (new) page B, and
 * 2) page A later to be reverted to an article on the same topic, with a sequence of edits there as well.

In this case, the time periods of the two series of edits will overlap.

The procedure above performs a page-history merge that (sooner or later) sequences the versions strictly by time, with the result that various versions of A will be interleaved between versions in the page history of page B (and/or vice-versa). Inspecting this merged history without means of distinguishing between the two overlapping progressions (since nothing in this history indicates which version belongs to which sequence) invites severe confusion.

An appropriate procedure for such a case is to forego the history merge, and instead handle the situation much like a normal merge; put a note pointing to the other version of the page on the article's talk page. If it is inappropriate to leave the second copy in the main article space, you can archive the duplicate page to Talk: space (i.e. by moving it to some suitable title, such as Talk:RandomArticle/OldVersion).

How to undo a history merge
If a history merge should not have been performed, then it may be undone. Note, however, that it can be quite tiring, especially if the article has a very long history. The following procedure is listed:


 * 1) Suppose A has been history merged into B.
 * 2) We want to get A's former history back into A.
 * 3) Delete B.
 * 4) Selectively undelete the revisions of B that made up the history of A before the history merge.
 * 5) Move B to A.
 * 6) Undelete the rest of the revisions of B.
 * 7) If A and/or B is now a redirect to itself or the other article, then revert or change the redirect target, as deemed appropriate.

An example of a successful history merge and undo is available at User:King of Hearts/Sandbox/6 (the A article) and User:King of Hearts/Sandbox/7 (the B article).

Old bugs
''Note: As of September, 2005, due to some minor bugs in the Mediawiki code, article histories may seem to contain anomalies after performing some of the procedures listed below. They are not actual data-base errors, the underlying data is correct; they are just problems with the information displayed. See for information about these seeming anomalies, and how to deal with them.''

Lost history bug
As of September, 2005, with MediaWiki 1.6alpha, the following peculiarity will probably be observed: after a successful undeletion, article histories may seem either:


 * to be missing the recently restored versions, or
 * to show the complete original history after a deletion/partial-restoration cycle, including versions which are actually still deleted.

These errors persist even if the browser's "Refresh" button is clicked. These do not seem to be actual database errors, and the underlying data is correct; they are just problems with the information displayed. Note that there seems to be no consistency as to which (if either) of these bugs will appear - expect to see either, or neither.

For some users, however, the bug can be cleared with a combination of purging and bypassing browser cache.

Work around
To see the correct, current, history of the article, select a different history length, e.g. "last 20" or "last 100", instead of the default 50. (Note that this trick only works once; if you do another restore, and the history is messed up again, you will need to select a different, previously unused length, to see the correct, current, history.)

Also, making an edit on the page just moved will force the correct history to be shown, so if you have to perform an edit on the target page for some other reasons (e.g. to restore the most recent version, step 4.3 above), this will make the correct history appear. Alternatively, if you don't want to leave things so that a naive user will be confused, make a dummy edit to the page, which will update the history.

Former bugs
Previous versions of the Wikimedia software displayed other, similar issues:


 * The success of the undeletion may be announced, but its results not be observable for a while, until the slave servers catch up to the master.
 * The merged history may have all the versions of the two formerly separate articles, but without the most recent being shown at the top of the history list, and without the most recently edited version being delivered by the server, until a further edit is made to the article.
 * It sometimes happens that viewing the history in step 3.1 shows the history of the just deleted page, not the history of the page just moved.

These bugs do not seem to be happening any more, but it's worth keeping an eye out for them.