Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Ras Singh
Ras Singh
88 Points

Git For iOS - Restoring Project After Accidentally Discarding Changes

Hey there, so I wanted to add github integration with my project so there was a proper work flow. I have been working on the project for 6-9 months.

I created a github account, and in Xcode I went to commit changes before linking the github repo as was done in the lesson.

However I got an error when committing, and accidentally discarded all changes. My project then went blank and the files disappeared.

I went into the trash and found a copy of my project, with what seems to be all the files (it also had the last save), I then restored it to the desktop and opened the project. However the project is blank and I am unsure why.

How can I restore my project after discarding the changes ?

Thanks.

1 Answer

Nicholas Richardson
Nicholas Richardson
4,867 Points

If the repo on GitHub has content in it I would suggest pulling down the changes with a source control app such as SourceTree.

But, it sounds like you were never able to commit the project to git. So I would do the following:

  1. Create a new repo on GitHub
  2. Using SourceTree clone the repo to your local machine
  3. Take the copy of your project and paste it into the cloned repo that is on your machine
  4. Using SourceTree commit the changes and then push to master.

Hopefully this helps!