Throughout the nanodegree, git will be our primary means of sharing code between students and instructors. Each of the five courses has a repository, and each branch in a repository represents a different step within a lesson.
Here are some scenarios you may encounter:
error: Your local changes to the following files would be overwritten by checkout: BirdSong/BirdSong/SongViewController.swift Please, commit your changes or stash them before you can switch branches.
If you try to checkout step42.2 and you get a message like this, it means you need to clear your working directory.
At this point, you have two options:
git branch step42.1-birdSongApp-gm
git add .
git commit -m “implementing Woody Woodpecker modification for birdsong playback”
Then what is the next step? Where should I push it to?
git checkout — .
Both options leave you with a clean working directory and put you in the right position to checkout the branch for the next step.
*Note. Okay, there are probably a lot more than 2 options, including stashing your recent changes. Learn more about stashing here.
You’ll never need to push to the course repositories, but don’t worry, the course repositories are set up so that students can’t push to them.
We do encourage you to make a remote repository of your own on github and use it to showcase your work!
error: pathspec 'step42.1-BirdSangApp' did not match any file(s) known to git.
If you get an error message like this, one way to troubleshoot is to look at a list of all of the branches in the current remote repository using the following command:
git branch -r
This is a way to double check that the branch with the name you are using does indeed exist (no typos etc.).