-
Notifications
You must be signed in to change notification settings - Fork 1
Challenge #4
To switch branches, you'll want to "check out" that branch. That will change your local working directory by adding and removing files their contents. You can always go back by switching back to it later.
Here's the solution:
$ git checkout level-2
Git tries to be safe. It won't let you perform a destructive operation very easily. If you have some uncommitted work while you switch branches, and that branch has its own content for that particular file, the checkout operation will fail.
Before you can continue, you'll either need to commit your work, stash it (a temporary place to put it), or reset it.
You can reset your changes to get rid of them with the following:
$ git reset --hard
The --hard
option indicates that you intend to lose your uncommitted changes. Only do this if you really don't want to commit them later, e.g. you edited a file by mistake.
To see the current status of the working directory, type:
$ git status