From the course: Git: Branches, Merges, and Remotes

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Switch branches

Switch branches

From the course: Git: Branches, Merges, and Remotes

Start my 1-month free trial

Switch branches

- [Presenter] Now that we know how to create a branch, let's see how we can switch to it. In the last movie, we learned to use the Git Branch Command, both to view a list of the branches and also to create a new branch and we created a new feature branch. And then we can see both of those here and we can tell that master is the currently checked out branch, the branch that we're currently working with. If we go to our working directory, that's the code that we're going to see. If we want to use the new feature branch instead, well then we need to check it out. So we use the command, git checkout and then the name of the branch that we want because we may have many of them. So git checkout new_feature, now, it says Switched to branch new_feature. Type git branch again and you can see that it is changed and now my current working directory is new_feature. That means that the head pointer is now pointing at new_feature. And if I make commits, they'll go on the new_feature branch, not on…

Contents