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
- [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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Branching overview4m 33s
-
(Locked)
Create branches3m 18s
-
(Locked)
Switch branches2m 27s
-
Create and switch branches3m 22s
-
(Locked)
Switch branches with uncommitted changes3m 39s
-
(Locked)
Compare branches4m 39s
-
(Locked)
Rename branches2m 21s
-
(Locked)
Delete branches4m
-
(Locked)
Configure command prompt6m 46s
-
(Locked)
-
-
-
-
-
-