67

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?

2 Answers 2

110

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
2
22

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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.