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

Compare branches

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

Start my 1-month free trial

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…

Contents