Sub topic 11
Version history and handling conflicts
This chapter assumes iCloud Drive is already on, you can find files in Finder, and you know the cloud and progress icons. It covers how to recover an earlier version of a file and what to do when two devices change the same file.
How iCloud Drive treats edits
iCloud Drive syncs the latest saved state of a file. It is not a backup system. If you save a bad edit, the bad edit syncs to every device. Recovery relies on two separate features: version history inside apps, and the 30-day recovery of deleted files.
Browsing earlier versions on the Mac
Apps that use the macOS document system, such as Pages, Numbers, Keynote, TextEdit, and Preview, keep earlier versions of a document as you work.
- Open the file in the app.
- Choose File > Revert To > Browse All Versions.
- Step through the saved versions in the timeline on the right.
- Click Restore to replace the current document with that version. In apps that support it, you can also copy content out of an older version and keep the current one.
Version history depends on the app. A plain file opened in an editor that does not use these features, such as a text file in a code editor, has no version list.
Recovering deleted or changed files from iCloud.com
Sign in at iCloud.com and open Drive. There you have two options:
- Recently Deleted holds files you removed. Files stay there for 30 days, then are gone permanently.
- Data Recovery, in the account settings, offers Restore Files for items deleted in the last 30 days.
A file you delete on the Mac also appears in the Trash. Emptying the Trash does not delete it from iCloud right away, but do not count on that after 30 days.
What a conflict is
A conflict happens when two devices change the same file before either change has synced. A common case is editing on a laptop while offline and also editing on an iPad.
iCloud does not merge the changes. It keeps both versions so nothing is lost. How you see this depends on the app:
- Some apps show a dialog saying the document has conflicting versions and ask you to choose one.
- Other files end up as two files in the same folder, with the second name changed, for example
budget 2.numbers.
Resolving a conflict
- Open both files and compare them. Do not delete either one yet.
- Copy anything you need from one into the other by hand.
- Move the copy you do not need to the Trash.
- Wait for the upload icon to clear before closing the Mac or going offline.
To find likely duplicates in a folder, you can list names that end in a space and a number:
find "$HOME/Library/Mobile Documents/com~apple~CloudDocs" -name "* 2.*"This is only a heuristic. It also matches files you named that way on purpose, and it misses other naming patterns.
Quick reference
| Situation | Where to look |
|---|---|
| Want an earlier edit of a Pages document | File > Revert To > Browse All Versions |
| Deleted a file by mistake | Trash on the Mac, or Recently Deleted on iCloud.com |
| Two copies of one file appeared | Compare both, merge by hand, delete the extra |
Exercise
You edited a Numbers file on your Mac while offline and also on your iPad. Afterward you see budget.numbers and budget 2.numbers. What should you do before deleting either file, and why does iCloud keep both?
Show answer
Open both and compare them, then copy the needed changes into one and trash the other. iCloud keeps both because it cannot merge edits made independently from the same starting version, so it keeps both to avoid losing either set of changes.