How do I compare two different branches in my Git repository?

Using git-diff  you can compare two branches by viewing a diff between them, or you can use git-log to view a list of commits that comprise the difference between them.

Compare two branches with git diff branch1..branch2.

# Changes between the tips of
# the feature and the master branches
$ git diff feature master
# OR
$ git diff feature..master

Notice the difference between two dots (..) and three dots (...) when comparing branches:

# Changes that happened on
# the master branch since when
# the feature branch was started from it
$ git diff feature...master

However, if you are only interested in listing the commits that make up the difference between two branches, without the diffs, you can use git log branch1..branch2

# list commits that are present in
# the feature branch but not in
# the master branch
$ git log feature..master

# list commits that are present in
# the master branch but not in
# the feature branch
$ git log master..feature

Check the Full Official Documentation for git-diff and git-log for more options.