Tag Archives: Snapshots

Snapshots in Xcode

When writing code, I usually write code in an incremental fashion. I try to get one set of functionality to work before I start on the next set. Due to this, I frequently create incremental backups of my files/project before I begin the next set of major changes or mass edits. This allows me to come back to a clean and consistent state if I ever need to.

I typically don’t work on a private branch, so I cannot check in my code until I am reasonably done. To create temporary incremental backups, I usually just end up making copies of my project folder.

Xcode has a handy feature called Snapshot that let’s you create a safety net before you make any major or risky changes to your files. Go to File->Make Snapshot (shortcut: command-control-s), and Xcode remembers the state of the project.

Screen shot-1.png

Now we are free to make changes to the source files all we want. If we need to return to the previous state we use the snapshot window. This window can be invoked from File->Snapshots

Screen shot-2.png

Simply select the snapshot that you want, and press the Restore button. Xcode automatically creates another snapshot when you restore to an older snapshot, which allows you to jump back and forth between two different versions of the project. Pretty useful!

Snapshots are stored in a disk image that lives in ~/Library/Application Support/Developer/Shared/SnapshotRepository.sparseimage


Filed under Tools, Xcode