List all commits from the tip of the branch (T) to a specific commit (S)
git rev-list --ancestry-path S..T
Usually GIT documentation names start
(S) and tip
(T) as A and B respectivelly
https://training.github.com/downloads/github-git-cheat-sheet/