It's not always possible to recover all merge events, counter-intuitive though that seems. The most likely reason is that, when you (or someone) asked for a merge, a "fast-forward" was possible (and the merge option
--no-ff was not given) so no "true merge" was performed. For example:
X -- X -- X -- A <--(master) X -- X -- X -- B <--(branch)
In this case a fast-forward is not possible because the branches have diverged, so after a merge you will see a merge commit.
git checkout master git merge branch X -- X -- X -- A -- M <--(master) / X -- X -- X -- B <--(branch)
but if you had
X --- X --- A <--(master) x --- x --- B <--(branch)
now you created a branch, but there hasn't been any new work on
master so the branches haven't diverged. Instead one is just behind the other. If you don't forbid it, a fast-forward will occur when you merge.
git checkout master git merge branch X --- X --- A --- x --- x --- B <--(branch)(master)
There is no record of a merge having occurred, and no way to recover the "merge event". (In the local repo where this took place, there is a reflog entry that could be used to figure it out; but reflog entries are temporary and are not shared with remotes, so for all practical purposes you can't count on any record of the merge.)
Moreover, there are lots of people who swear that a linear history is "cleaner" (even if that history ends up made mostly of commits that have never been built and tested), so they deliberately rearrange their commit topology to allow every merge to be a fast-forward. And there are other techniques for combining lines of code that are used in special cases.
So what does it mean for your question?
First, not all merge events are recorded. If you want to make sure your merge events are recorded so that they can be observed later, then you must always merge with the
--no-ff option (and without the
Second, the git log output will generally show all of the merge events that were recorded. I can't think of a case where history simplification would exclude a merge, but if you're concerned you can add
--full-history to the log command. You can even ask to see just the merges (
You also can get a graphical view of the branches with
git log --graph, or by using a gui like
Note that by default any of the commands I mentioned for viewing commits/merges will only show those reachable from your currently-checked-out commit (HEAD). If you want to see everything, specify
--all; if you want to see everything reachable from a list of branches, list the branches.