How do I restore from a previous commit on Xcode 8?

10,114

Solution 1

In Xcode 9:

  1. Choose Source Control navigator.
  2. Select (branch) committed project.
  3. Click "Editor->Checkout ...", or click "Editor->Branch->Checkout ..."

This works for me, it restores the entire project at once.

Solution 2

You need to

git checkout COMMIT_2_ID

More info in this answer:

https://stackoverflow.com/a/4114122/1163930

Solution 3

You can use the version editor in XCODE to do revert each of your files to the previous version. Go to View > Version Editor > Show Version Editor. There is a timeline icon at the bottom of the split view. You can revert to previous commits.

Share:
10,114
Mestwick
Author by

Mestwick

Updated on June 04, 2022

Comments

  • Mestwick
    Mestwick almost 2 years

    Let's say I have 5 local commits:

    • commit 1
    • commit 2
    • commit 3
    • commit 4
    • commit 5

    At this point when I'm working, I'd like to go back to commit 2.

    How would I do so?

    This was so easy using snapshots in previous versions of Xcode.

    "Discard changes" only goes back to commit 5, right?