Question

get all commits of a branch already merged into parent branch

My git repo timeline looks something like this :

  1. After merging the feature-A branch into main branch [commit K], I want to log all the commits that are only part of feature-A branch [commits B, I and J].
  2. And adding in to the 1st point, what if I want to exclude the merge commits like commit I.

Also, why does dot operator give blank output when trying this command : git log main..feature-A

 3  44  3
1 Jan 1970

Solution

 1

You're looking for --exclude-first-parent-only main..feature-A, all commits in feature-A's history that aren't in main's first-parent history.

The plain main..feature-A you tried is all commits in feature-A's history that are not in main's history—but feature-A is in main's history, so there's nothing to list.

--no-merges doesn't list any merges.

2024-06-30
jthill