Restore master or a branch to previous commit

Restoring to a previous commit

With Abstract’s version control, you can revert a project’s master or your branches to any previous commit. Restoring a previous commit returns the master or your branch to exactly how it looked at that point in time. You can also restore individual files to previous versions of the file without affecting all of the other files in your branch.

To prevent data loss and accidental overwrites, you cannot restore to a commit that came before an update from parent or update from master.

Restore master or a branch to a previous commit

Versions-Restore-Branch-Commit.png

Any Contributor can restore master to a previous commit. You can only restore branches you own.

To restore master or a branch to a previous commit:

  1. Open the Abstract desktop app.
  2. Select the project you’d like to restore.
  3. Select Master (to restore master) or a branch (to restore your branch) from the left side pane.
  4. Click the COMMITS tab at the top.
  5. Select the commit you’d like to restore to.
  6. Click the clock icon in the top right.
  7. Summarize why you’re restoring to this commit.
    Modal-Restore-Commit.png
  8. Click RESTORE COMMIT.

This restore will be recorded in the master or branch history.

Tip: If you change your mind about restoring to a previous commit, simply follow the instructions above to restore to a different commit. Each commit is a snapshot of the complete project. You don’t lose any commit history by restoring.

Restore a specific file to a previous commit

Sometimes you may want to restore a single file to a previous version while keeping all of the other files in your master or branch up to date. You can do this on any individual file in a commit by clicking the restore file button instead of restore commit.

Restoring a file only returns that one file on master or your branch to exactly how it looked at that point in time. All of the other files will remain as they are.

Versions-Restore-File.png

To restore a file to a previous commit:

  1. Open the Abstract desktop app.
  2. Select the project with the file you’d like to restore.
  3. Select Master (to restore a file in master) or a branch (to restore a file in your branch) from the left side pane.
  4. Click the COMMITS tab at the top.
  5. Select the commit that has the version of the file that you’d like to restore.
  6. Click the clock icon on the right side of the file name. Look for the tooltip to make sure it says “Restore file” (it should NOT say “Restore commit”).
  7. Summarize why you’re restoring this file.
    Modal-Restore-File.png
  8. Click Restore File.

Restore work from before an update

In order to prevent data loss and accidental overwrites, you cannot restore before a branch update. However, you may find that there are times when you need to restore work from one of these previous commits. You can restore this type of older work by creating a new branch from a previous commit, exporting an older version of the file and replacing the newer version, or opening a file untracked to copy changes to a new commit.

To restore work by creating a new branch:

Versions_Restore-BranchfromCommit.png

  1. Open the Abstract desktop app.
  2. Select the project with the work you’d like to restore.
  3. Select Master (to restore a file in master) or a branch (to restore a file in your branch) from the left side pane.
  4. Click the COMMITS tab at the top.
  5. Right click the commit that has the work that you’d like to restore and select Create Branch...
  6. Give your new branch a name and select Create branch.

With this method, your new branch will be added as a child branch below your current working branch. You can switch to this branch and continue working from the files as they were at that point in time, then merge the child branch back into the parent branch when you’re finished.

Read our merging best practices to learn more about resolving any merge conflicts that might come up at this time.

To restore large amounts of older work or entire files:

Versions_Restore-ExportFile.png

  1. Open the Abstract desktop app.
  2. Select the project with the work you’d like to restore.
  3. Select Master (to restore a file in master) or a branch (to restore a file in your branch) from the left side pane.
  4. Click the COMMITS tab at the top.
  5. Select the commit that has the work that you’d like to restore.
  6. Click the … menu next to the file name and select Export…
  7. Save the file to your desktop.
  8. Click the Files tab at the top of the page to navigate to the current version of the master or branch.
  9. Right click the matching file and select Replace…
  10. Select the file you saved to your desktop and choose Import.

To restore small amounts of older work:

Versions_Restore-OpenUntracked.png

  1. Open the Abstract desktop app.
  2. Select the project with the work you’d like to restore.
  3. Select the branch from the left side pane.
  4. Click the COMMITS tab at the top.
  5. Select the commit that has the work that you’d like to restore.
  6. Click Open Untracked next to the file that you want to restore.
  7. Copy the work you want to restore.
  8. Click the Files tab at the top of the page to navigate to your current work.
  9. Click Open in Sketch to open the current version of the file that you want to restore.
  10. Paste the copied layers from the untracked file into the correct artboards in the current file.
  11. Click File > Save or CMD+S to save your changes.
  12. Click Commit Changes to complete the restore.

Deleting artboards can cause collections to have missing screens. For the best results using this method, copy only the changes on the layers you want to keep and paste them onto existing artboards in your current file.