Your question is a little unclear because I'm not sure if you want to see a diff/patch of the changes between master
and feature
, or you just want to see which branches contain which commits that the other branch doesn't have.
Assuming that you just want to see what commits are in your feature
branch that don't exist in master
(i.e. which commits in feature
are "ahead" of master
), then you can do
$ git log --oneline --graph master..feature
If you want to see how both master
and feature
have diverged, you can use this command:
$ git log --oneline --graph --first-parent \
--decorate --left-right master...feature
> 5bef654 (feature) A ...
> f7c65ea B ...
> fc66245 C ...
> 7435fc0 D ...
< bf68204 (master) X ...
< 0c10ed1 Y ...
< 27bb774 Z ...
The above output shows commits in master
that are not in feature
with <
in front of them (since you used master...feature
with master on the left <
side of the command), while commits in feature
that aren't in master are marked with >
since you used feature
on the right side of master...feature
. The triple dots ...
in this form are important, don't leave them out.
You can learn more about specifying Commit Range from the Pro Git book.