How do I run git log to see changes only for a specific branch?


I have a local branch tracking the remote/master branch. After running git-pull and git-log, the log will show all commits in the remote tracking branch as well as the current branch. However, because there were so many changes made to the remote branch, I need to see just the commits made to the current local branch.

What would be the Git command to use to only show commits for a specific branch?


Configuration information:

[branch "my-branch"]
  remote = origin
  merge = refs/heads/master


Using git log

Assuming that your branch was created off of master, then while in the branch (that is, you have the branch checked out):

git log master..

If you are not in the branch, then you can add the branch name to the "git log" command, like this:

git log master..branchname

If your branch was made off of origin/master, then say origin/master instead of master.

Goofy alternative using "cherry"

You can make the "cherry" command do this as well, although the output is not as useful. While in a branch, do this to find out what commits are in the branch that are not in master:

git cherry -v master

Git error on commit after merge - fatal: cannot do a partial commit during a merge

How do I 'overwrite', rather than 'merge', a branch on another branch in Git?