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.
Compare branches
- [Instructor] Once we have several branches, we have the ability to compare them to see what the differences are between their change sets. Let's see how to do it. And let's start by just typing git branch to remind ourselves what branches we have, and what the current working branch is. So for the moment I'm on the shorten title branch. In order to compare two things in git, we can use git diff. And we can use it to compare two files or any tree ish. So that would be, in this case, a branch. Let's pick the master branch. We'll use dot dot to compare it to the new_feature branch. Notice that I'm not on either of those branches. I can diff anything that Git knows about. I'll hit return, and it will come up and it will tell us what's the difference. We can see very clearly that there's a change to this one line, and we can see what this change is. We can also change this. Instead of new feature let's do master compared to shorten_title. Now it shows us the difference between the master…
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)
-
-
-
-
-
-