Search code examples
git

git diff showing only commits that revision/branch A is ahead of revision/branch B


Sometimes I have the following problem:

  1. Add some commits in a feature branch.

  2. Update master from upstream.

  3. Want to see the diff between the feature branch and master, but git diff master shows all of the things that have been added/removed in master, when I really only want to see the commits that the feature branch is ahead of master, not the ones that it's behind.

Is there a way to do this without having to merge master into the feature branch?


Solution

  • I think the right answer is triple dot

    git diff master...feature
    

    That shows only new changes on feature with respect to master. See also: git diff - show only what's new on the remote