> ## Content Index
> Fetch the complete content index at: https://debugly.dev/llms.txt
> Use this file to discover other available public pages before exploring further.

# Where Did the Branch Commits Go in Git’s First-Parent Log?
- URL: https://debugly.dev/git-first-parent-missing-commits/
- Published: 2026-11-08T04:49:00.000Z
- Updated: 2026-11-08T04:49:00.000Z
- Description: A first-parent log can omit commits that are still reachable. Check exact ancestry, then choose a commit range or a tree diff to answer the right question.
- Author: Rohit Bhadani
- Tags: Git, DevOps, Debugging

A feature is on `main`, but its commit is nowhere in the release log. Before you assume somebody rebased it away, check whether the log uses `--first-parent`. At a merge, that option walks back through the branch that received the merge and skips the other parent paths. The feature commit can be reachable from `main` even though the release log never prints it. Use `git merge-base --is-ancestor` to check whether the exact commit is reachable.

*This is an AI-prepared, documentation-based explainer, not a personally reproduced incident. The history below is illustrative. See the* [*editorial policy*](https://debugly.dev/editorial-policy/)*.*

## One branch tip, two useful views

Imagine `main` contains a release preparation commit while a feature branch contains two changes of its own. You merge the feature into `main` with a merge commit. The merge records the old `main` tip as its first parent and the merged feature tip as another parent. Starting at the merge, a normal walk can follow both paths. The [Git log documentation](https://raw.githubusercontent.com/git/git/v2.51.1/Documentation/git-log.adoc?ref=debugly.dev) describes how `--first-parent` follows only the first parent when it encounters a merge.

That's useful for release notes: you see the merge as one event on the integration branch rather than seeing every fixup commit inside it. The catch is that this view answers “what landed along this line?” It can't answer “can I reach this exact commit from this tip?” The release summary didn't lose your commit. It just wasn't hired to find it.

## Check the graph before you check the patch

These commands are for an illustrative merge commit at `main`; substitute the actual tip and feature commit when diagnosing a real repository. Use the same starting tip for both logs and leave out path filters while checking ancestry.

```
git log --first-parent --oneline main
git log --graph --oneline main
git merge-base --is-ancestor <feature-commit> main
```

The [ancestry check](https://raw.githubusercontent.com/git/git/v2.51.1/Documentation/git-merge-base.adoc?ref=debugly.dev) exits with status 0 when the first commit is an ancestor of the second, and 1 when it isn't. Treat other nonzero results as errors. In particular, make sure the commit resolves locally and check for a shallow checkout with `git rev-parse --is-shallow-repository`. A shallow clone can be missing the very part of history you need, even when it builds the current tree just fine.

If the commit is absent from the first-parent log but the ancestry test succeeds, you've found a traversal difference. If the test fails with complete history, inspect how the work was integrated. Squash merges and rebases can produce different commits containing the same changes; a negative ancestry result only says that *that commit object* isn't an ancestor. Conversely, an ancestor can still be reachable after its changes were reverted. Debugly's [merge revert explainer](https://debugly.dev/git-reverted-merge-missing-changes/) traces that case separately.

## Choose the comparison your automation needs

If you need to inspect the commits introduced by one merge relative to its first parent, use the [revision range](https://raw.githubusercontent.com/git/git/v2.51.1/Documentation/gitrevisions.adoc?ref=debugly.dev) `MERGE^1..MERGE`, without adding `--first-parent`. It lists commits reachable from the merge but not its first parent, including the merge itself. If you need the net file change at that integration point, compare the two trees instead:

```
git log --oneline MERGE^1..MERGE
git diff MERGE^1 MERGE
```

Here `MERGE` stands for the merge commit, not a literal name. The range can include a commit whose change was undone later on the branch. The diff only shows the net difference between the two trees, including the effect of any merge conflict resolution. Neither answer can stand in for the other.

Keep the first-parent walk for a release timeline. For an audit that promises to inspect every introduced commit, test the range on a fixture with a merge and put one uniquely identifiable change on the second-parent path. Verify that the timeline stays short and the audit still sees the change. That test catches a log option quietly changing the question your automation answers.