Suppose your git commit history looks like this:
A---B---C---D---E---F master
\ /
X---Y---Z topic
Is it possible to have git list only the commits on master, A-F? In other words, if the commit was on a merged-in branch, I don't want it show.
Does this not work?
git log
has option--first-parent
, so you won't gettopic
history.When merged from
master
, themaster
commits are the first parents in merge. Git log allows to display only those commits with --first-parent, so you get the right stuff.There is another general way to go about this that doesn't rely on
--first-parent
which will be helpful in certain situations.. using the branch exclusion filtersgit log origin/topic ^origin/master
This will give you a log oforigin/topic
with all oforigin/master
's commits removed.you could also add in
--no-merges
which will hide merge commits which you may or may not want.Another handy tip is to use
shortlog
instead oflog
which will give you more of an abbreivated summary that can be handy for release notes, or communication of whats in a branch.Update
After re-reading this, you actually would want nearly the inverse of what I posted; however it would end up excluding everything that is on master and foo (
git log origin/master ^origin/foo
) . However you could also get what you ask for ( hide all commits that are part of merges) withgit log origin/master --no-merges