git log the difference between 1 branch from another

GitGit MergeGit Log

Git Problem Overview


I have 2 branches A and B.

Whenever I run a build, Branch A gets merged into Branch B. I want to be able to email out all the updates made in A, since the last time the build was ran. How can I use git log to be able to copy all the commits made in A since the last A -> B merge?

Git Solutions


Solution 1 - Git

That'll be

git log B..A

E.g. "display all commits that are in A but not in B" Or if you wish to do it against non local branches

git log origin/B..origin/A

Solution 2 - Git

An alternative syntax would be to use:

$ git log refA refB --not refC

or in your case of comparing only two branches

$ git log A --not B

Also from the GIT SCM Commit Ranges Docs

When comparing two branches it really comes down to preference. I just find this a bit more readable and don't have to worry about confusing A...B with A..B (also mentioned in the docs).

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAdam JohnsonView Question on Stackoverflow
Solution 1 - GitcheView Answer on Stackoverflow
Solution 2 - GitErik AybarView Answer on Stackoverflow