Going Back to a Previous Git Commit in Xcode

Something that can happen to you when using version control is you commit a change to the version control repository, realize you made a mistake, and want to go back to an earlier commit. How do you do this in Xcode?

Xcode provides no direct way to go back to an earlier commit. What you have to do is create a branch off the earlier commit and work off that branch.

Open the source control navigator by choosing View > Navigators > Show Source Control Navigator. Select the current branch from the source control navigator. The Xcode editor shows all the commits for that branch.

Select the commit you want to use, right-click, and choose Branch from CommitNumber. The commit number is a long hexadecimal number. Name the branch and click the Create button. Now you’re working from the earlier commit.