Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
We only recently created the `testing` branch, so you probably remember what's on it. But suppose you've gotten pulled away for a week to work on a higher-priority project. Or suppose it's not even your branch, but one created by a collaborator. As we'll see later, branches can be transferred to other repositories, and you're going to need a convenient way to see what's on those branches.
-
git diff
can show you the differences between two branches. For example:git diff master testing
- Git looks up the commits that each branch currently points to, and gives us a diff between those commits.
- You aren't resricted to the branch that's currently checked out, either.
- If we want to see the differences between the
add-letters
andtesting
branches, you can run this command:git diff add-letters testing
- If we want to see the differences between the
- When you provide only one branch name, Git will compare the contents of the working directory to that branch.
- I can show the difference between my files and the
master
branch by running:git diff master
- If you have modified files in your working directory that haven't been committed yet, this version of the
git diff
command will show you those changes. - If everything is committed, then it will look the same as comparing two branches.
- I can show the difference between my files and the
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up