Please note, if you have joined Bootcamp Prep after September 4th, 2018 this article will not be applicable. If you are one of these students and need to restart a lab, we recommend clearing your code from your IDE and rewriting it again.
You may get to a point on a lab sometimes and just think it's best to start this lab from scratch. That's OK! Here are some steps you can follow so you can restart the lab.
If you just want to start a lab over WITHOUT saving your work, you can follow these steps, otherwise there is a way to restart a lab AND save your old work in case you want to look back on it later.
Restart a lab WITHOUT saving your changes
1. Click on the GitHub icon next to the
OPEN IDE button to open up your fork of the labs repository.
2. Within your repository click the
Settings tab (make sure you are on your fork of that lab).
3. At the very bottom of that
Settings page click on the
Delete this repository button, enter the name of the repository and click
I understand the consequences, delete this repository. Note: if you’re using the downloaded IDE you may also have to remove that repositories folder from your computer.
4. Go back to
learn.co, refresh the page and click the
OPEN IDE button. - This will re-fork a fresh version of the lab for you.
Restart a lab AND save your changes
Step 1: Make sure you are in the correct lab directory by going to Learn.co and clicking the Open button for the lab you are on.
Step 2: Save all your files. One great way to make sure that all your files are saved is by closing all open tabs in the Learn IDE. If that tab is close, then that file must be saved!
Step 3: Add and commit all your files. We can do this by typing two commands into the Learn IDE terminal
git add . and
git commit -m "Old code that is not working". This will track all your changes using git.
Step 4: Save changes to a new branch. You can do this by typing the following into your Learn IDE Terminal:
git checkout -b old-code. This will create a branch for you that has all your old code!
Step 5: Switch back to master. Type the following into your terminal:
git checkout master. This will switch you from your new branch, back to the master branch.
Step 6: Find the point you want to roll back to. Type
git log into your Learn IDE terminal. This will show you ALL the changes that have been made to this lab since it was first created. What we're looking for here is the most recent SHA (7 digitis to the left of the commit message) that was not done by you. Note: You may have to scroll up in the Learn IDE terminal to find this. Once you have copied the SHA, you can escape out of git log by pressing
Step 7: Reset: You can now reset back to this point by typing in
git reset --hard <the SHA you copied>. Now this lab is reset to when you first cloned it!
Step 8: Push code to github. To keep your github up to date, run the following commands:
git push origin master -f and
git push origin old-code:old-code. Note: If you've already pushed up a branch on this lab called old-code, you may need to add
-f at the end of this command to overwrite that (as I did in the video).
Check out this video walkthrough to help you through these steps: